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] すごく初歩のJavaScript (比較演算子)

Posted at

#JavaScript (比較演算子)

JavaScript 自分用の覚え書きです。

比較演算子

script.js
const age = 25;

// 「age >= 20」 → true と表示される
console.log(age >= 20);

// 「age < 20」 → false と表示される
console.log(age < 20);

// ageの値が20以上の場合、実行される
if (age >= 20) {
  console.log("私は20歳以上です");
}

比較演算子 (値が等しいかどうか)

script.js
const password = "qiitapasspass";

// passwordの値が"qiitapasspass"の場合
if (password === "qiitapasspass") {
  console.log("ログインしました");
}

// passwordの値が"qiitapasspass"でない場合
if (password !== "qiitapasspass") {
  console.log("ログインできません");
}
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?