How to check if all elements in array that pass a condition in JavaScript

1 Answer

0 votes
const condition = (n) => n < 10;

const array = [1, 5, 7, 2, 0, 12];

console.log(array.every(condition ));

  
    
    
/*
run:
    
false
    
*/

 



answered Nov 30, 2020 by avibootz
...