<p>y = 5, 计算 x = ++y, y 和 x 为:</p> <button onclick="myFunction()">点我</button> <p><strong>注意:</strong> x 和 y的值将会改变。</p> <p id="demo1"></p> <p id="demo2"></p> <script> function myFunction() { var y = 5; var x = ++y; document.getElementById("demo1").innerHTML = y; document.getElementById("demo2").innerHTML = x; } </script>