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.

if文でfalse判定される条件式(JS)

Last updated at Posted at 2020-07-14
if (undefined) {
  // 実行されない
}

if (null) {
  // 実行されない
}

if (0) {
  // 実行されない
}

if ('') {
  // 実行されない
}

if (false) {
  // 実行されない
}
  • undefined
  • null
  • 0
  • 空文字
  • false

は全てif文内ではfalse判定されます。(雰囲気で使っていたのでまとめた←)
上記項目の頭に!をつけて使うと便利に使えます。
(例) if (!null) {}

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?