Returns the first found value that matches predicate or undefined.
predicate
Use some if you don't care about the value, just whether it appears. Use filter to get all value(s) that match predicate.
Map to search
Function that returns true for a matching value
Found value or undefined
const overThirty = find(people, person => person.age > 30); Copy
const overThirty = find(people, person => person.age > 30);
Returns the first found value that matches
predicate
or undefined.Use some if you don't care about the value, just whether it appears. Use filter to get all value(s) that match
predicate
.