-
-
Save TimBlock/073d0c402155b46c2460 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Your code here. | |
function every(array,predicate){ | |
for(var i = 0; i<array.length; i++){ | |
if (!predicate(array[i])) | |
return false; | |
} | |
return true; | |
} | |
function some(array,predicate){ | |
for(var i = 0; i<array.length; i++){ | |
if (predicate(array[i])) | |
return true; | |
} | |
return false; | |
} | |
console.log(every([NaN, NaN, NaN], isNaN)); | |
// → true | |
console.log(every([NaN, NaN, 4], isNaN)); | |
// → false | |
console.log(some([NaN, 3, 4], isNaN)); | |
// → true | |
console.log(some([2, 3, 4], isNaN)); | |
// → false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment