- 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 - flip method
Syntax
_.flip(func)
Creates a function that invokes func with arguments reversed.
Arguments
func (Function) − The function to flip arguments for.
Output
(Function) − Returns the new flipped function.
Example
var _ = require('lodash'); var flipped = _.flip(function() { return _.toArray(arguments); }); console.log(flipped(1, 2, 3, 4));
Save the above program in tester.js. Run the following command to execute this program.
Command
\>node tester.js
Output
[ 4, 3, 2, 1 ]
lodash_function.htm
Advertisements