Find first element in an array matching a condition in JavaScript
examples/javascript/find_first.js
let animals = ['snake', 'camel', 'etruscan shrew', 'ant', 'hippopotamus', 'giraffe']; let first = animals.find(a => a.length > 5); console.log(first);
Published on 2020-12-27
If you have any comments or questions, feel free to post them on the source of this page in GitHub. Source on GitHub.
Comment on this post