Open In App

Lodash _.isUndefined() Method

Last Updated : 20 Oct, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

Lodash _.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:

  • value: This parameter holds the value to check.

Return Value:

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

Example 1: In this example, we are printing the boolean result of whether the given value is undefined or not by the use of the _.isUndefined() method.

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: In this example, we are printing the boolean result of whether the given value is undefined or not by the use of the _.isUndefined() method.

JavaScript
// The lodash library is included
const _ = require("lodash");

// Use of _.isUndefined() method 
console.log(_.isUndefined(10));
console.log(_.isUndefined(undefined)); 

Output:

false
true

Next Article

Similar Reads