I have two arrays
var A = [1,2,3,4,5];
var B = [1,2,3,4,5,6,7,8,9];
Now I want to check if all elements of A are exist in B or not like this
var A = [1,2,3,4,5];
var B = [1,2,3,4,5,6,7,8,9];
// true
var A = [1,2,3,4,5];
var B = [1,2,3,4,5];
// True
var A = [1,2,3,4,5];
var B = [1,2,3,5,6,7,8,9];
// False
I have tried using some like this
if(A.some(item => B.includes(item)) {
return true;
}
But it filters the array and returns true if one of the value is true