クリックすると、デモに表示されるxに5が追加されないのはなぜですか?ボタンが要素デモに5を追加しないのはなぜですか?
<h1>The += Operator</h1>
<p id="demo"></p>
<script>
var x = 10;
document.getElementById("demo").innerHTML = x;
function add(){
x = x+=5;
}
</script>
<button onclick="add()"> += </button>
</body>
です。変数を変更するだけです。また、 'x + = 5;'ではなく 'x = x + = 5;'です。 – Xufox