I found a similar answer to my question here: Check if an array contains any element of another array in JavaScript, unfortunately, the OP is asking if ANY elements equal to ANY elements in another array.
In my case, I actually need to check if two or more elements equal to 2 or more elements in another array. Otherwise, it should return false.
I tried methods similar to the mentioned question but I can't get it to target X number of matches...
Array.filter(el => el.colors.some(x => colors2.includes(x)))
This is good only for ANY number of matches...
.lengthof that result and you'd get the number of matches.Array.filter(el => el.colors.some(x => colors2.includes(x)))my code:Array.filter(el => el.colors.some(x => colors2.includes(x))).length