Creates a new Boolean (true/false) value.
Syntaxnew Boolean ([ boolValue ])
([ boolValue ])
Other values (like 1 and 0) are converted to a Boolean expression.
Return ValueIf the boolean value is omitted, or is false , 0, null , NaN , or an empty string, Boolean returns false. Otherwise, it returns true true.
ExamplesUsing Boolean to define a test condition
var x = new Boolean(false);
if (x) {
}
Using implicit Boolean constructor
var IsLoggedIn = true;
if (isLoggedIn) {
}
Remarks
The Boolean object is a wrapper for the Boolean data type. JavaScript implicitly uses the Boolean object whenever a Boolean data type is converted to a Boolean object.
You rarely instantiate the Boolean object explicitly.
PropertiesThe following table lists the properties of the Boolean object.
Property Summary prototype Returns a reference to the prototype for a Boolean. FunctionsThe following table lists the functions of the Boolean object.
MethodsThe following table lists the methods of the Boolean object.
Method Summary constructor Initializes a Boolean object. toString Returns a string representation of a Boolean object. See also SpecificationBoolean Objects ECMAScript® Language Specification Standard ECMA-262 5.1 Edition / June 2011
AttributionsMicrosoft Developer Network: Article
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