Categories:

JavaScript Kit > JavaScript Reference > Here

Boolean Object

Last updated: June 20th, 2004

The Boolean object is an object wrapper for a boolean (true or false) value. You can explicitly define a Boolean via:

new Boolean([value])

1) Value- Initial value of the Boolean object. The value is converted to a boolean value, if necessary. If value is not specified, 0, -0, null, false, NaN, undefined, or the empty string (""), the object is set to false. All other values, including any object or the string "false", create an object with a value of true.

For example:

var guess=new Boolean(false) //false value
var guess=new Boolean(0) //false value
var guess=new Boolean(true) //true value
var guess=new Boolean("whatever") //true value

Properties

Properties Description
constructor Specifies the function that created the object's prototype.
prototype Allows you to define properties on the Boolean that is shared by all Boolean objects.

Methods

Methods Description
toString() Returns a string specifying the value of the Boolean, in this case, "true" or "false."
valueOf() Returns the primitive value of a Boolean object.

Reference List

Partners
Right column

CopyRight 1998-2014 JavaScript Kit. NO PART may be reproduced without author's permission.