Skip to content
Related Articles
Open in App
Not now

Related Articles

Lodash _.isUndefined() Method

Improve Article
Save Article
  • Last Updated : 06 Sep, 2020
Improve Article
Save Article

The _.isUndefined() method is used to find whether the given value is undefined or not. It returns True if the given value is undefined. Otherwise, it returns false.

Syntax:

_.isUndefined(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 undefined, else false.

Example 1: In the following example, const _ = require(“lodash”) is used to import the lodash library into the file.

Javascript




// The lodash library is included 
const _ = require("lodash");  
      
// Use of _.isUndefined() method 
console.log(_.isUndefined(null)); 
console.log(_.isUndefined(void 0)); 
console.log(_.isUndefined('gfg')); 

Output:

false
true
false

Example 2:

Javascript




// The lodash library is included
const _ = require("lodash");  
      
// Use of _.isUndefined() method 
console.log(_.isUndefined(window.missingVariable)); 
console.log(_.isUndefined(10)); 
console.log(_.isUndefined(undefined)); 

Output:

true
false
true
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!