- 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 - spread method
Syntax
_.spread(func, [start=0])
Creates a function that invokes func with the this binding of the create function and an array of arguments much like Function#apply.
Arguments
func (Function) − The function to spread arguments over.
[start=0] (number) − The start position of the spread.
Output
(Function) − Returns the new function.
Example
var _ = require('lodash'); var say = _.spread(function(who, what) { return who + ' says ' + what; }); console.log(say(['Joe', 'Hi']));
Save the above program in tester.js. Run the following command to execute this program.
Command
\>node tester.js
Output
Joe says Hi
lodash_function.htm
Advertisements