_.invoke(object, path, [args])
Invokes the method at path
of object
.
Since
4.0.0
Arguments
-
object
(Object): The object to query. -
path
(Array|string): The path of the method to invoke. -
[args]
(...*): The arguments to invoke the method with.
Returns
(*): Returns the result of the invoked method.
Example
var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; _.invoke(object, 'a[0].b.c.slice', 1, 3); // => [2, 3]
Please login to continue.