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,8,条件分岐,if,else,初心者向け

Posted at

8,条件分岐 if else

JS(JavaScript)で条件分岐をおこなってみましょう!

const score = 20;

if (score === 20)   score と20が一緒
if (score < 20)      score より20が大きいか
if (score > 20)      score より20が小さいか

const score = 10;

if (score === 20) {
  document.getElementById("test").textContent = "スコアは20です"
} else if (score === 10) {
  document.getElementById("test").textContent = "スコアは10です"
} else {
  document.getElementById("test").textContent = "スコアは20ではないです"
}

もしこれなら次こうする
けど違ったらこれするもしくはこれか
違ったらこれする

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?