0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Javascript基礎知識#6(while文)

Last updated at Posted at 2020-11-15

##はじめに
この記事は私の脱コピペを目指すために書いている自分用のメモです。

※内容について、誤った知識やもっとわかりやすい表現等ございましたら、ご指摘いただけますと幸いです。

##目次

  1. while文とは
  2. while文の書き方
  3. while文の例

#1. while文とは
while 文では「()」の中に記述した条件式が true を返すあいだ、繰り返し処理を行う

#2. while文の書き方
while文の基本形は下記のような感じです。

while(条件式) {
  //繰り返す処理を書く
}

#3. while文の例

let num = 3;
while(num < 100) {
  console.log(num);
  num = num * 3;
}
console.log('end');
>> 3
>> 9
>> 27
>> 81
>> end

こんな感じ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?