This is not quite the function for it. How can you Loop thru each array to compare values? Or should these data structures be different? Or transformed first?
var result = videos.filter(function(videos, index) {return videos["userID"] === blocked.documentID })
Here’s the data being compared. Goal is to compare userID with DocumentID.
const videos = [
{
userID: "5lyU0TCyqRcTD3y7Rs2FGV8h2Sd2",
name: "Wedge Antilles",
faction: "Rebels"
},
{
userID: "8",
name: "Ciena Ree",
faction: "Empire"
},
{
userID: "40",
name: "userIDen Versio",
faction: "Empire"
},
{
userID: "66",
name: "Thane Kyrell",
faction: "Rebels"
}
];
const blocked = [
{
id: 2,
name: "Wedge Antilles",
documentID: "5lyU0TCyqRcTD3y7Rs2FGV8h2Sd2"
},
{
id: 8,
name: "Ciena Ree",
documentID: "Empire"
},
{
id: 40,
name: "Iden Versio",
documentID: "Empire"
},
{
id: 66,
name: "Thane Kyrell",
documentID: "Rebels"
}
];