• 最終更新日:

while文を使った繰り返し処理の書き方

let i = 1;
while (i <= 3) {
  console.log(i);
  i++; //1足されて先頭に戻る。white文の場合、これがないと無限ループになる
}