Last Updated : 03 Sep, 2024
Lodash _.isBoolean() method checks if the given value can be classified as a Boolean value or not.
Syntax:_.isBoolean(value);Parameters:
Example 1: In this example, the _.isBoolean() method returns true when the value is a boolean(true or false).
JavaScript
// Defining Lodash variable
const _ = require('lodash');
let val = true;
// Checking for Boolean
console.log("The Value is Boolean : "
+ _.isBoolean(val));
let val1 = false;
// Checking for Boolean
console.log("The Value is Boolean : "
+ _.isBoolean(val1));
Output:
The Value is Boolean : true
The Value is Boolean : true
Example 2: In this example, the _.isBoolean() method returns false when the value is a null value.
JavaScript
// Defining Lodash variable
const _ = require('lodash');
let 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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4