The
_.findKey() function is used to return the key value where the predicate logic or condition returns the truth value or undefined. The predicate function/condition is transformed through iteratee to facilitate shorthand syntaxes.
Syntax:
_.findKey(object, predicate, [context])
Parameters: This function accept three parameters as mentioned above and described below:
- list: This parameter is used to hold the list of items.
- predicate: This parameter is used to hold the truth condition.
- context: The text content which need to be display. It is optional parameter.
Return Value: It returns the key value where the predicate logic or condition returns truth or undefined.
Example 1:
Output:
👁 Image
Example 2: