Skip to content

Instantly share code, notes, and snippets.

@lubien
Created June 24, 2017 05:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lubien/626223c6f805d45150f630a9ed5089ab to your computer and use it in GitHub Desktop.
Save lubien/626223c6f805d45150f630a9ed5089ab to your computer and use it in GitHub Desktop.
Meeting Lambda #12: Quantification - Has Integer? Log
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