How to check if any value in a one-dimensional array a is larger than x using some in Node.js

1 Answer

0 votes
const a = [1, 5, 8, 3, 10, 12, 4];
const x = 9

const isAnyValueLarger = a.some(value => value > x);

console.log(isAnyValueLarger);



     
/*
run:
     
true
     
*/


 



answered Jun 26 by avibootz
...