Lodash _.isNull() Method
Lodash _.isNull() method is used to find whether the value of the object is null. If the value is null then returns true otherwise it returns false.
Syntax:
_.isNull(value);
Parameter:
- value: This parameter holds the value to check.
Return Value:
This method returns true if the value is null, else false.
Example 1: In this example, we are checking whether the given value is null or not by the use of the _isNull() method.
Javascript
// Requiring the lodash library const _ = require( "lodash" ); // Use of _.isNull() // method let gfg = _.isNull( null ); let gfg1 = _.isNull(void 0); // Printing the output console.log(gfg); console.log(gfg1); |
Output:
true
false
Example 2: In this example, we are checking whether the ‘NaN’ is null or not by the use of the _isNull() method.
Javascript
// Requiring the lodash library const _ = require( "lodash" ); // Use of _.isNull() // method let gfg = _.isNull(NaN); // Printing the output console.log(gfg); |
Output:
false