Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
Loop through the array and test each element against the callback predicate. Return the index of the first element that passes the test, short-circuiting the iteration. Return -1 if no element satisfies the condition.
FindIndex returns a numeric position rather than the element itself, which is useful when you need to know where a match occurs for subsequent splice, slice, or index-based operations.
Updated Feb 2026