JavaScript valueOf()Method
Example
Return the primitive value of the Boolean object:
var bool = new Boolean(0);
var myvar = bool.valueOf();
var myvar = bool.valueOf();
myvarOutput:
false
Try it Yourself »
Definition and Usage
The valueOf() method returns the primitive value of a Boolean object.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the valueOf() method.
Syntax
boolean.valueOf()
Return Value
| Type | Description |
|---|---|
| Boolean | trueorfalse |
Other Extensions
JavaScript Boolean Object