A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/javascript/Boolean below:

Boolean · WebPlatform Docs

Boolean Summary

Creates a new Boolean (true/false) value.

Syntax
new Boolean ([ boolValue ])

([ boolValue ])
boolValue
Required. The initial Boolean value for the new object. Possible values are true and false.

Other values (like 1 and 0) are converted to a Boolean expression.

Return Value

If the boolean value is omitted, or is false , 0, null , NaN , or an empty string, Boolean returns false. Otherwise, it returns true true.

Examples

Using 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.

Properties

The following table lists the properties of the Boolean object.

Property Summary prototype Returns a reference to the prototype for a Boolean. Functions

The following table lists the functions of the Boolean object.

Methods

The 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 Specification

Boolean Objects ECMAScript® Language Specification Standard ECMA-262 5.1 Edition / June 2011

Attributions

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