I have 2 arrays, where arr1
is a subset of arr2
, but I am unable to check this using Javascript.
arr1 = [1,2]; //array1
arr2 = [[1,2],[2,3],[1,3],[1,4]]; //array2
I tried achieving this by using arr2.includes(arr1)
which always returns false
.
let arr1 = [1,2];
let arr2 = [[1,2],[2,3],[1,3],[1,4]];
console.log(arr2.includes(arr1)); //getting false
I expect the output to be true
, but the actual output is false
.
Can anyone help me solve this problem and direct me whether this is the right approach to solve this problem or not?