JavaScript Find

find() returns the FIRST element for which the callback returns a truthy value, or undefined when nothing matches. It stops scanning as soon as it finds a match.

Syntax

arr.find((x) => x > 1)

Examples

Input Arguments Output
[1, 2, 3] x => x > 1 2
↳ Only the first match is returned.
[1, 2] x => x > 10 undefined

When to use it

  • Look up one record by id or property.
  • Get the first value satisfying a rule.

Gotchas

  • No match returns undefined, not null and not -1.
  • Only the first match is returned. Use filter() to get them all.

Try it live

Type your input and see Find transform it instantly.

Find()

Type above to see the result…

Want to go further? Chain Find with other functions, pipe one output into the next and watch your data transform in the visual Playground.

Related functions

© 2026 Heifara Buval