Using Array.find to Get the First Matching Item in Javascript


find returns the first element in the array that satisfies the provided testing function.

Source Code

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