VOOZH about

URL: https://www.geeksforgeeks.org/javascript/lodash-_-isempty-method/

⇱ Lodash _.isEmpty() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Lodash _.isEmpty() Method

Last Updated : 9 Jan, 2025

Lodash _.isEmpty() method checks if the value is an empty object, collection, map, or set. Objects are considered empty if they have no own enumerable string keyed properties. Collections are considered empty if they have a 0 length. Similarly, maps and sets are considered empty if they have a 0 size.

Syntax:

_.isEmpty(value);

Parameters:

  • value: This parameter holds the value that needs to be Checked for Empty value.

Return Value:

  • This method returns a Boolean value(Returns true if the given value is an Empty value, else false).

Example 1: In this example, the _.isEmpty() method returns true as null is an empty value itself which does not hold any value.

Output:

The Value is Empty : true

Example 2: In this example, the _.isEmpty() method returns true as the length of the array is zero.

Output:

The Value is Empty : true

Example 3: In this example, the _.isEmpty() method returns true for both of the Boolean values.

Output:

The Value is Empty : true
Comment