I've tried a few solutions to this and have had a look round on here but can't seem to get this working.
I have 2 arrays, and want to check if any of the items in the array contain any of the strings in the other array.
const stepsShown = ["ref2", "ref7"];
const items = [
{ name: "item1", element: "ref1"},
{ name: "item2", element: "ref2"}
];
const refsExist = items.some((r) =>{stepsShown.indexOf(r.element);});
In this example I would expect refsExist to be true
I think I am a little muddled in my syntax! Can anyone help please? :)
includes, notindexOf- and you need to return the result from the function