减零(minus zero)的布尔值是 false
- <!DOCTYPE html>
- <html>
- <body>
- <p>显示 -0 的布尔值:</p>
- <button onclick="myFunction()">试一试</button>
- <p id="demo"></p>
- <script>
- function myFunction() {
- var x = -0;
- document.getElementById("demo").innerHTML = Boolean(x);
- }
- </script>
- </body>
- </html>