</!DOCTYPE html>
</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>*/
显然,我是一个初学者,但我没有其他人可以问。如果有人能解释demop.innerHTML="x=" + x + ", y=" +y;
这段代码背后的原因,那将会很有帮助。