Finding Elements with Array.find() in Javascript


Find the first element in an array that satisfies a test.

Source Code

let numbers = [1, 3, 5, 7, 9];
let found = numbers.find(element => element > 5);
console.log(found); // 7
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments