Creates a function that gets the argument at index n. If n is negative, the nth argument from the end is returned.
n
The index of the argument to return.
Returns the new pass-thru function.
5.10.0
const func = nthArg(1)func('a', 'b', 'c', 'd')// => 'b'const func = nthArg(-2)func('a', 'b', 'c', 'd')// => 'c' Copy
const func = nthArg(1)func('a', 'b', 'c', 'd')// => 'b'const func = nthArg(-2)func('a', 'b', 'c', 'd')// => 'c'
Creates a function that gets the argument at index
n
. Ifn
is negative, the nth argument from the end is returned.