- Lodash Tutorial
- Lodash - Home
- Lodash - Overview
- Lodash - Environment Setup
- Lodash - Array
- Lodash - Collection
- Lodash - Date
- Lodash - Function
- Lodash - Lang
- Lodash - Math
- Lodash - Number
- Lodash - Object
- Lodash - Seq
- Lodash - String
- Lodash - Util
- Lodash - Properties
- Lodash - Methods
- Lodash Useful Resources
- Lodash - Quick Guide
- Lodash - Useful Resources
- Lodash - Discussion
Lodash - nthArg method
Syntax
_.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.
Arguments
[n=0] (number) − The index of the argument to return.
Output
(Function) − Returns the new pass-thru function.
Example
var _ = require('lodash'); var func = _.nthArg(1); console.log(func('a', 'b', 'c', 'd')); func = _.nthArg(2); console.log(func('a', 'b', 'c', 'd'));
Save the above program in tester.js. Run the following command to execute this program.
Command
\>node tester.js
Output
b c
lodash_util.htm
Advertisements
To Continue Learning Please Login
Login with Google