Created
June 24, 2017 05:28
-
-
Save lubien/626223c6f805d45150f630a9ed5089ab to your computer and use it in GitHub Desktop.
Meeting Lambda #12: Quantification - Has Integer? Log
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
const checkAndLog = x => { | |
console.log('passed by', x) | |
return Number.isInteger(x) | |
} | |
const xs = ['a', 1, 2, 3, 4] | |
const ys = ['a', 'b', 'c', 'd', 'e'] | |
const xsHasinteger = xs.some(checkAndLog) | |
// passed by a | |
// passed by 1 | |
console.log(xsHasinteger) // true | |
const ysHasinteger = ys.some(checkAndLog) | |
// passed by a | |
// passed by b | |
// passed by c | |
// passed by d | |
// passed by e | |
console.log(ysHasinteger) // false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment