Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript valueOf() Method

JavaScript valueOf() Method

Boolean Object Reference JavaScript Boolean object

Example

Returns the primitive value of a Boolean object:

var bool = new Boolean(0);

var myvar = bool.valueOf();

myvar Output result:

false

Try it »


Definition and Usage

The valueOf() method can return the primitive value of a Boolean object.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the valueOf() method.


Syntax

boolean

.valueOf()

Return Value

Type Description
Boolean true orfalse

Boolean Object Reference JavaScript Boolean object