nthArg

Util
since 4.0.0

Arguments

  • number The index of the argument to return.

Returns

Function the new pass-thru function.

Creates a function that gets the argument at index n. If n is negative, the nth argument from the end is returned.

Example of Lodash _.nthArg

var func = _.nthArg(1);
func('a', 'b', 'c', 'd');
// => 'b'

var func = _.nthArg(-2);
func('a', 'b', 'c', 'd');
// => 'c'