Friday, September 5, 2025
HomeLanguagesJavascriptLodash _.isNaN() Method

Lodash _.isNaN() Method

The Lodash _.isNaN() Method checks the given value is NaN or not. This method is not the same as the JavaScript isNaN() method which returns true for undefined and other non-number values.

Syntax:

_.isNaN( value )

Parameters: This method accepts a single parameter as mentioned above and described below:

  • value: This parameter holds the value that need to be checked for NaN.

Return Value: This method returns a Boolean value (Returns true if the value is NaN, else false).

Example 1: 

Javascript




// Defining Lodash variable 
const _ = require('lodash'); 
  
// Checking
console.log(_.isNaN(NaN));


Output:

true

Example 2: For checking with an empty source this method returns true.

Javascript




// Defining Lodash variable 
const _ = require('lodash'); 
  
// Checking
console.log(_.isNaN(new Number(NaN)));


Output:

true

Example 3: This method also works for arrays.

Javascript




// Defining Lodash variable 
const _ = require('lodash'); 
  
// Checking
console.log(_.isNaN(undefined)); 
  
// Checking
console.log(_.isNaN(10));


Output:

false
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
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6634 POSTS0 COMMENTS
Nicole Veronica
11801 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11863 POSTS0 COMMENTS
Shaida Kate Naidoo
6750 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6701 POSTS0 COMMENTS
Umr Jansen
6718 POSTS0 COMMENTS