编辑下面的代码:【加编码】
<html> <body> <p>Given that y=5, calculate x=y--, and display the result.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var y=5; var x=y--; var demoP=document.getElementById("demo") demoP.innerHTML="x=" + x + ", y=" + y; } </script> <p><strong>Note:</strong> Both variables, x and y, are affected.</p> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂