Monday, July 27, 2026
HomeLanguagesJavascriptLodash _.isBoolean() Method

Lodash _.isBoolean() Method

The Lodash _.isBoolean() method checks if the given value can be classified as Boolean value or not.

Syntax:

_.isBoolean( value )

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

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

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

Example 1: This method returns true when the value is a boolean(true or false).

Javascript




// Defining Lodash variable
const _ = require('lodash'); 
     
var val = true;
  
// Checking for Boolean
console.log("The Value is Boolean : " 
    +_.isBoolean(val));


Output:

The Value is Boolean : true

Example 2: 

Javascript




// Defining Lodash variable
const _ = require('lodash'); 
     
var val = false;
  
// Checking for Boolean
console.log("The Value is Boolean : " 
    +_.isBoolean(val));


Output:

The Value is Boolean : true

Example 3:

Javascript




// Defining Lodash variable
const _ = require('lodash'); 
     
var val = null;
  
// Checking for Boolean
console.log("The Value is Boolean : "
    +_.isBoolean(val));


Output:

The Value is Boolean : false

Note: This will not work in normal JavaScript because it requires the lodash library to be installed. 

Lodash library can be installed using npm install lodash.

RELATED ARTICLES

Most Popular

Dominic
32520 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6903 POSTS0 COMMENTS
Nicole Veronica
12017 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12115 POSTS0 COMMENTS
Shaida Kate Naidoo
7023 POSTS0 COMMENTS
Ted Musemwa
7265 POSTS0 COMMENTS
Thapelo Manthata
6980 POSTS0 COMMENTS
Umr Jansen
6972 POSTS0 COMMENTS