Javascript examples for Boolean:constructor
You can use the Boolean() function to find out if an expression is true:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {// ww w . jav a 2s .co m document.getElementById("demo").innerHTML = Boolean(10 > 9); } </script> </body> </html>
Or you can use the following
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w w w . j av a 2 s .c om*/ document.getElementById("demo").innerHTML = 10 > 9; } </script> </body> </html>