Category : filter

const likedUsers = [{ id: “1” }, { id: “2” } ] const needToFilter = [{ id: “1”, userInfo: “info” }, { id: “2”, userInfo: “info” }, { id: “3”, userInfo: “info” } ] likedUsers.forEach(item => needToFilter.filter(needToFilter => { return needToFilter.id !== item.id })); console.log(users); I have two arrays like that and if needToFilter array’s ..

Read more

I’m trying to look through an object, and some attributes, I have limited number of values that they can be assigned to. Here’s how I check for their value at the moment: for (const [attribute, value] of Object.entries(params.object)) { if(attribute == "accountType") if(value != "external" && value != "internal") return { status: `Failed! ‘${attribute}’ must ..

Read more