JavaScript「超」入門3-07_monster
1 2 3 4 5 6 7 8 9 10 11 |
<script> 'use strict'; let enemyEnagy = 100; window.alert('戦闘スタート!') while(enemyEnagy > 0){ let attackEnagy = Math.floor(Math.random() * 30) + 1; enemyEnagy -= attackEnagy; console.log('敵のエネルギーは:' + enemyEnagy + 'になりました。'); } console.log('Conguraturation 敵は消滅しました。!') </script> |
<script>…</script>間以外は同じ