How to find the first element in array that equal to N in JavaScript

1 Answer

0 votes
const array = [3, 6, 1, 8, 9, 4, 5];

const found = array.find(element => element > 5);

console.log(found);


  
    
    
/*
run:
    
6
    
*/

 



answered Nov 30, 2020 by avibootz
...