filter array by value based on another array
const cards = [
[
{
word: 'cry'
},
{
word: 'fishing'
},
{
word: 'fly'
},
{
word: 'hug'
}
],
[
{
word: 'open'
},
{
word: 'play'
},
{
word: 'run'
},
{
word: 'sing'
}
]
];
let difficultWords = ['cry', 'run', 'sing'];
const wrongCard = cards.map((card) =>
card.filter((c) => difficultWords.includes(c.word))
);
console.log(wrongCard);