Wednesday, February 12, 2020

an example of using .some in JavaScript to find even one match to some complicated condition in a search of records

This has this which gives either true or false and in this particular case: true

const array = [1, 2, 3, 4, 5];
const even = (element) => element % 2 === 0;
console.log(array.some(even));

No comments:

Post a Comment