<!DOCTYPE html>
<html>
<body>
<p>Click the button to loop through a block of code five times.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = "";
for ( var i = 0; i < 5; i++ ) {
x = x + "The number is " + i + "<br>";
}
document.getElementById("demo").innerHTML=x;
}
</script>
</body>
</html>
我了解它返回的内容,但我不了解每个语句之前的 x。
x = x + "The number is " + i + "<br>";