CodeDevStack

Check if at least one value in an array is present in another array

October 16, 2020

If you want to check if at least one value in an array is present in another array, use this snippet:

const list = [1, 2, 3];

[1, 2].some(value => list.includes(value)); //true
[3, 4, 5].some(value => list.includes(value)); //true
[4, 5, 6].some(value => list.includes(value)); //false
[].some(value => list.includes(value)); //false