Lodash _.isNull() Method
Last Updated :
25 Oct, 2023
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
const _ = require( "lodash" );
let gfg = _.isNull( null );
let gfg1 = _.isNull(void 0);
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
const _ = require( "lodash" );
let gfg = _.isNull(NaN);
console.log(gfg);
|
Output:
false
Share your thoughts in the comments
Please Login to comment...