_.nthArg

_.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

  1. [n=0] (number): The index of the argument to return.

Returns

(Function): Returns the new pass-thru function.

Example

1
2
3
4
5
6
7
8
9
10
var func = _.nthArg(1);
 
func('a''b''c''d');
// => 'b'
  
 
var func = _.nthArg(-2);
 
func('a''b''c''d');
// => 'c'
doc_Lodash
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.