LoginSignup
0
0

More than 1 year has passed since last update.

JavaScript (ES5)基本の書き方 【swich, while】

Last updated at Posted at 2021-10-10

【条件分岐】
・swich

var item = "犬";

switch(item) {
  case "猫":
    console.log("にゃーと鳴きます");
    break;
  case "犬":
    console.log("ワンーと鳴きます");
    break;
  default:
  console.log("動物が存在しません");
} 

【繰り返し処理】
・while

var i = 1;

// while文を用いて、変数iが50未満のときに繰り返すループ文
while(i < 50) {
  console.log(i);
  i += 1;
}
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