The find() method returns the first element that passes your test, or undefined if none match. It short-circuits on success. This tutorial covers callback syntax, five examples, handling no-match cases, and comparisons with filter() and findIndex().
01
Syntax
find(cb)
02
First hit
One element
03
No match
undefined
04
Stops early
Short-circuit
05
Objects OK
By property
06
ES2015
Modern support
Fundamentals
Introduction
When you need one item from a list—the first user with an admin role, the first product in stock, the first score above 90—find() is the direct tool. It walks the array until your callback returns true, then returns that element immediately.
If you need all matches, use filter(). If you need the index instead of the value, use findIndex().
Concept
Understanding the find() Method
array.find(callback) invokes your callback for each element in order. The first time the callback returns a truthy value, find() returns that element and stops. If every callback is falsy, the result is undefined.
Unlike indexOf, which compares with strict equality (===), find() lets you write any custom test function—ideal for objects and complex conditions.
💡
Beginner Tip
A stored undefined value in the array can be a valid match. Distinguish “not found” from “found undefined” with findIndex() or an optional wrapper if that edge case matters in your app.
This pattern mirrors database lookups in frontend state. For large lists, consider indexing objects in a Map keyed by id for O(1) access.
Applications
🚀 Common Use Cases
User lookup — find account by email, username, or id.
Cart & catalog — locate product by SKU or slug.
Config — pick the first matching rule or feature flag.
Validation — detect the first invalid field in a form array.
Navigation — resolve the active menu item from a tree.
Games — find the first enemy in range or alive player.
🧠 How find() Runs
1
Start at index 0
Walk the array in ascending index order.
Iterate
2
Run callback
Pass (element, index, array) to your predicate.
Test
3
Truthy?
Return that element immediately. Otherwise continue.
Match
4
🔎
End of array
If no match, return undefined.
Important
📝 Notes
Returns undefined when nothing matches—not null or -1.
Short-circuits: elements after the first match are never tested.
A matching undefined element is indistinguishable from “not found” without findIndex.
Do not mutate the array in ways that reorder unvisited indexes during the search.
For last-match searches in modern JS, use findLast().
ES2015 method—not available in Internet Explorer without a polyfill.
Compatibility
Browser & Runtime Support
Array.prototype.find() was added in ES2015 (ES6). It is available in all evergreen browsers and modern Node.js versions.
✓ Baseline · ES2015
Array.prototype.find()
Supported in Chrome 45+, Firefox 25+, Safari 7.1+, Edge 12+, and Node 4+. Not available in Internet Explorer.
97%Modern browser support
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
Array.find()Excellent
Bottom line: Safe for modern web apps. For IE11, polyfill or use a manual loop with an early break.
Wrap Up
Conclusion
The find() method is the idiomatic way to grab the first array element that satisfies a condition. It is concise, stops early, and works beautifully on arrays of objects.
Remember to handle undefined, and switch to filter() or findIndex() when you need all matches or the position instead of the value.
Assume null means not found—find returns undefined
Use find() when you need every match (filter())
Mutate the array unpredictably inside the callback
Use find() on huge lists repeatedly without indexing
Forget IE11 needs a polyfill
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about Array.find()
Your foundation for first-match array searches.
5
Core concepts
📝01
Syntax
arr.find(cb)
API
🔎02
First only
One element.
Result
⚡03
Short-circuit
Stops early.
Fast
❓04
No match
undefined
Guard
📋05
vs filter
One vs all.
Compare
❓ Frequently Asked Questions
find() returns the first element in an array for which the callback returns a truthy value. If no element matches, it returns undefined.
No. find() only reads elements through your callback. The original array is unchanged.
It returns undefined—not null and not an empty array. Always check for undefined before using the result.
find() stops at the first match and returns that single element. filter() collects every match into a new array.
find() returns the matching element (the value). findIndex() returns the numeric index of the first match, or -1 if none.
find() is an ES2015 (ES6) feature. All modern browsers support it; Internet Explorer does not.
Did you know?
find() and findIndex() were added together in ES2015. They share the same search logic—one returns the value, the other returns where it lives. ES2023 added findLast() and findLastIndex() for tail-first searches.