Object.find_key

Object.find_key

Object.find_key

Function

Returns the first key name for which the callback result is true.

Syntax

Parameters

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

Return value

TypeDescription
String/EmptyReturns the key name if found, otherwise returns Empty.

Example

Notes

  • find_key traverses objects in order of insertion.
  • The traversal stops as soon as the first matching key is found.