function every(array, predictate){
array.forEach(function(x){
if (!predictate(x))
{
return false;
}
});
return true;
}
console.log(every([NaN, NaN, NaN], isNaN));
//true
console.log(every([NaN, NaN, 4], isNaN));
//suppose to return false, but still return true...
The second console.log
should return false but it returns true. What did i do wrong?