Favorites

JavaScript Boolean Object

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Boolean
JavaScript Fundamental · ConstructorThis object is supported by all modern browsers.
Updated 28th November 2026

Boolean is the type with only two values, true and false. Calling Boolean(value) converts any value to true or false using JavaScript's truthiness rules.

Description

The Boolean type has just two values, true and false, and is what comparisons and conditions produce. Calling Boolean(value) as a function converts any value to a boolean, which is the same as writing !!value.

The values that convert to false are called falsy: false, 0, -0, 0n, '', null, undefined and NaN. Everything else is truthy, including '0', 'false', empty arrays and empty objects. Avoid new Boolean(false): it creates an object, and every object is truthy.

Conditions in if statements, loops and the logical operators convert values to booleans automatically, so you rarely need Boolean() explicitly. A common use is array.filter(Boolean), which removes all falsy values from an array. When comparing, avoid value == true, because it converts types in surprising ways; test the value directly or compare with ===.

Creating

true
false
Boolean(value)

Example

console.log(Boolean(0), Boolean(''), Boolean(null));
console.log(Boolean('0'), Boolean([]), Boolean({}));
console.log(!!'hello');

const items = ['a', '', 'b', 0, 'c'];
console.log(items.filter(Boolean));

Browser Support

The following information will show you the current browser support for the Boolean object. Hover over a browser icon to see the version that first introduced support for this object.

This object is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee