- 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 - negate method
Syntax
_.negate(predicate)
Creates a function that negates the result of the predicate func. The func predicate is invoked with the this binding and arguments of the created function.
Arguments
predicate (Function) − The predicate to negate.
Output
(Function) − Returns the new negated function.
Example
var _ = require('lodash'); function isEven(n) { return n % 2 == 0; } console.log(_.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)));
Save the above program in tester.js. Run the following command to execute this program.
Command
\>node tester.js
Output
[ 1, 3, 5 ]
lodash_function.htm
Advertisements