Array.find

Array.find

Array.find

Function

Returns the first element for which the callback result is true.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
callbackFnNoEmptyThe callback signature is fn(value, index, current).

Return value

TypeDescription
Any/EmptyReturns the element if found; returns Empty if not found.

Example

Notes

  • Search from left to right.