The Boolean() constructor used to create a new Boolean object. The Boolean() constructor accepts one argument and produces a Boolean object, which holds a value of either true or false depending on the type and value of the argument passed in.
Syntax
Boolean(value)
Parameters
It accepts a single argument.
- Value: The value of the boolean object.
Example 1: How to Use JavaScript Boolean() Constructor
let data1 = Boolean(true);
let data2 = Boolean(false);
console.log(data1);
console.log(data2);
Output
true
false
Example 2: Using the Boolean Constructor to Convert String, Number, null and Date to Boolean Values
let data1 = Boolean("Welcome");
let data2 = Boolean("42");
let data3 = Boolean(123);
let data4 = Boolean(null);
let data5 = Boolean(new Date());
Output
true
true
true
false
true
Browser Compatibility
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
That’s it!
Related posts

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.