Boolean.prototype.valueOf()
The valueOf()
method returns the primitive value of a
Boolean
object.
Syntax
valueOf()
Return value
The primitive value of the given Boolean
object
Description
The valueOf()
method of Boolean
returns the primitive value
of a Boolean
object or literal Boolean
as a Boolean data type.
This method is usually called internally by JavaScript and not explicitly in code.
Examples
Using valueOf()
x = new Boolean();
myVar = x.valueOf(); // assigns false to myVar
Specifications
Specification |
---|
ECMAScript Language Specification # sec-boolean.prototype.valueof |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
valueOf | ChromeFull support1 | EdgeFull support12 | FirefoxFull support1 | Internet ExplorerFull support4 | OperaFull support4 | SafariFull support1 | WebView AndroidFull support1 | Chrome AndroidFull support18 | Firefox for AndroidFull support4 | Opera AndroidFull support10.1 | Safari on iOSFull support1 | Samsung InternetFull support1.0 | DenoFull support1.0 | Node.jsFull support0.10.0 |
Legend
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.