Finding Array Elements with Array.find() in Javascript


Find the first element in an array that satisfies a provided testing function.

Source Code

let numbers = [1, 5, 10, 15];
let found = numbers.find(function(num) {
  return num > 9;
});
console.log(found); // 10
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments