Wednesday, October 8, 2025
HomeLanguagesJavascriptLodash _.isNil() Method

Lodash _.isNil() Method

Lodash _.isNil() method is used to check if the value is null or undefined. If the value is nullish then returns true otherwise it returns false.

Syntax:

_.isNil(value)

Parameters:

  • value(*) parameter holds the value to check.

Return Value:

This method returns true if the value is nullish, else false.

Example 1: In this example, null is null itself so it is returning true.

Javascript




// Requiring the lodash library 
const _ = require("lodash"); 
    
// Use of _.isNil() 
// method
let gfg = _.isNil(null);
        
// Printing the output 
console.log(gfg);


 Output:

true

Example 2: In this example, void is null so it is returning the true value.

Javascript




// Requiring the lodash library 
const _ = require("lodash"); 
    
// Use of _.isNil() 
// method
let gfg = _.isNil(void 0);
        
// Printing the output 
console.log(gfg);


 Output:

true

Example 3: In this example, NaN is not null so it is giving us a false value.

Javascript




// Requiring the lodash library 
const _ = require("lodash"); 
    
// Use of _.isNil() 
// method
let gfg = _.isNil(NaN);
        
// Printing the output 
console.log(gfg);


Output:

false 
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32342 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6712 POSTS0 COMMENTS
Nicole Veronica
11875 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11937 POSTS0 COMMENTS
Shaida Kate Naidoo
6833 POSTS0 COMMENTS
Ted Musemwa
7092 POSTS0 COMMENTS
Thapelo Manthata
6786 POSTS0 COMMENTS
Umr Jansen
6789 POSTS0 COMMENTS