Javascript examples for Boolean:valueOf
The valueOf() method returns the primitive value of a boolean.
None
A Boolean, either "true" or "false"
The following code shows how to return the primitive value of a Boolean object:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from ww w . j a v a 2s . co m var bool = false; var x = bool.valueOf(); document.getElementById("demo").innerHTML = x; } </script> </body> </html>