4.17.11
3.10.1
2.4.2
1.3.1

_.nthArg([n=0])

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

Since

4.0.0

Arguments

argument
[n=0]
type
number
description
The index of the argument to return.

Returns

(array)

Example

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

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

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