Thursday, September 4, 2025
HomeLanguagesJavascriptLodash _.falsey() Method

Lodash _.falsey() Method

The Lodash _.falsey() method checks whether the given value is falsey or not and returns the corresponding boolean value. A falsey value is one that means false in a boolean context.

Syntax:

_.falsey( value );

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

  • value: Given value is to be checked for falsey value.

Return Value: This method returns a Boolean value true if the given value is falsey, else false.

Note: This will not work in normal JavaScript because it requires the lodash.js contrib library to be installed. Lodash.js contrib library can be installed using npm install lodash-contrib.

Example 1:

Javascript




// Defining underscore lodash variable 
var _ = require('lodash-contrib'); 
  
var bool = _.falsey(false);
    
console.log("Given Value is Falsey : ", bool);


Output:

Given Value is Falsey : true

Example 2:

Javascript




// Defining underscore lodash variable 
var _ = require('lodash-contrib'); 
  
var bool = _.falsey(10);
    
console.log("Given Value is Falsey : ", bool);


Output:

Given Value is Falsey : false

Example 3:

Javascript




// Defining underscore lodash variable 
var _ = require('lodash-contrib'); 
  
var bool = _.falsey([ 1, 2, 3 ]);
console.log("Given Value is Falsey : ", bool);
  
var bool = _.falsey({});
console.log("Given Value is Falsey : ", bool);


Output:

Given Value is Falsey : false
Given Value is Falsey : false

Example 4:

Javascript




// Defining underscore lodash variable 
var _ = require('lodash-contrib'); 
  
var bool = _.falsey(false);
console.log("Given Value is Falsey : ", bool);
  
var bool = _.falsey("false");
console.log("Given Value is Falsey : ", bool);


Output:

Given Value is Falsey : true
Given Value is Falsey : false
RELATED ARTICLES

Most Popular

Dominic
32263 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6627 POSTS0 COMMENTS
Nicole Veronica
11799 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11858 POSTS0 COMMENTS
Shaida Kate Naidoo
6749 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6696 POSTS0 COMMENTS
Umr Jansen
6716 POSTS0 COMMENTS