Tin mới
JavaScript: Scripting language
Web APIs: Programming interfaces
Structuring content with HTML module
Dynamic scripting with JavaScript module
Boolean values are typically produced by relational operators, equality operators, and logical NOT (!). They can also be produced by functions that represent conditions, such as Array.isArray(). Note that binary logical
Boolean values are typically produced by relational operators, equality operators, and logical NOT (!). They can also be produced by functions that represent conditions, such as Array.isArray(). Note that binary logical
Boolean primitives and Boolean objects
For converting non-boolean values to boolean, use Boolean as a function or use the double NOT operator. Do not use the Boolean() constructor with new.
Boolean primitives and Boolean objects
For converting non-boolean values to boolean, use Boolean as a function or use the double NOT operator. Do not use the Boolean() constructor with new.
Note: Unlike other type conversions like string coercion or number coercion, boolean coercion does not attempt to convert objects to primitives by calling user methods.
Many built-in operations that expect booleans first coerce their arguments to booleans. The operation can be summarized as follows:
Many built-in operations that expect booleans first coerce their arguments to booleans. The operation can be summarized as follows:
The constructor function that created the instance object. For Boolean instances, the initial value is the Boolean constructor.
Returns a string of either true or false depending upon the value of the object. Overrides the Object.prototype.toString() method.
Returns a string of either true or false depending upon the value of the object. Overrides the Object.prototype.toString() method.
Returns a string of either true or false depending upon the value of the object. Overrides the Object.prototype.toString() method.
Returns the primitive value of the Boolean object. Overrides the Object.prototype.valueOf() method.
This page was last modified on Jul 10, 2025 by MDN contributors.