Lodash – flip method

  • Post author:
  • Post category:Lodash
  • Post comments:1 Comment
Lodash - flip method

Syntax Of Lodash flip method

_.flip(func)

The Lodash flip method 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 ]

Next Topic – Click Here

This Post Has One Comment

Leave a Reply