Lodash _.invoke() Method
The _.invoke() method is invoked the method at path of object.
_.invoke(object, path, args)
Parameters: This method accepts three parameters as mentioned above and described below:
- object: It holds the object to query.
- path: It holds the path of the method to invoke the element.
- args: The arguments to invoke the method with.
Return Value: This method returns the result of the invoked method.
Example 1: Here, const _ = require(‘lodash’) is used to import the lodash library in the file.
[ 9 ]
[ 6, 8, 10 ]