The util.types.isBooleanObject() method is an inbuilt application programming interface of util module which is primarily designed to support the needs of Node.js own internal APIs.
The util.types.isBooleanObject() method is used to determine whether the value is a Boolean object or not.
Syntax:
javascript
Output:
javascript
Output:
util.types.isBooleanObject( value )Parameters: This method accepts a single parameters value which holds any valid JavaScript data types like Boolean, Null, Number, Object, etc. Return value: It returns a Boolean value i.e. returns true if value is a Boolean object otherwise it returns false. Below examples illustrate the use of util.types.isBooleanObject() method in Node.js: Example 1:
// Node.js program to demonstrate the
// util.types.isBooleanObject() method
// Using require to access util module
const util = require('util');
// Using util.types.isBooleanObject() method
console.log(util.types.isBooleanObject(true));
// Using util.types.isBooleanObject() method
console.log(util.types.isBooleanObject("Map"));
// Using util.types.isBooleanObject() method
console.log(util.types.isBooleanObject(new Boolean(false)));
false false trueExample 2:
// Node.js program to demonstrate the
// util.types.isBooleanObject() method
// Using require to access util module
const util = require('util');
// Creating a Boolean Object
const a = new Boolean(true);
// Creating a Boolean Object
const b = new Boolean(false);
// A Boolean type variable
const c = true;
// Using util.types.isBooleanObject() method
console.log(util.types.isBooleanObject(a));
// Using util.types.isBooleanObject() method
console.log(util.types.isBooleanObject(b));
// Using util.types.isBooleanObject() method
console.log(util.types.isBooleanObject(c));
true true falseNote: The above program will compile and run by using the
node index.js command.
Reference: https://nodejs.org/dist/latest-v13.x/docs/api/util.html#util_util_types_isbooleanobject_value