Firstly, the .includes
method does not work with my framework, so I omit this here.
I have checkIn(el,ar)
function to check if el
in ar
like this:
function checkIn(el){
var check = false;
for (i = 0; i < ar.length; i++){
if(el === ar[i]){
check = true;
break;
};
};
return check;
};
it works normaly. Then I want to use the .every
method to check if every element of a given array is in another given array
var x = [1,2,3];
var y = [1,2,3,4,5];
var check = x.every(checkIn(y))
check
needs to be true, but it doesn't work?