Lodash _.findKey() Method
The _.findKey() method is similar to _.find() method except that it returns the key of the first element, predicate returns true for instead of the element itself.
Parameters: This method accepts two parameters as mentioned above and described below:
- object: It holds the object to inspect every element.
- predicate: It holds the function that the method invoked per iteration.
Return Value: This method returns the key of the matched element else undefined.
Example 1: Here, const _ = require(‘lodash’) is used to import the lodash library in the file.