Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc.
The _.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)
Parameters: This method accepts a single parameter as mentioned above and described below:
- value: This parameter holds the value to check.
Return Value: This method returns true if the value is null, else false.
Example 1: Here, const _ = require(‘lodash’) is used to import the lodash library into the file.
Javascript
// Requiring the lodash library  const _ = require( "lodash" );       // Use of _.isNull()  // method let gfg = _.isNull( null );          // Printing the output  console.log(gfg); |
Output:
true
Example 2: Â
Javascript
// Requiring the lodash library  const _ = require( "lodash" );       // Use of _.isNull()  // method let gfg = _.isNull(void 0);          // Printing the output  console.log(gfg); |
Output:
false
Example 3: Â
Javascript
// Requiring the lodash library  const _ = require( "lodash" );       // Use of _.isNull()  // method let gfg = _.isNull(NaN);          // Printing the output  console.log(gfg); |
Output:
false