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?

JavaScriptの falsy

0
Posted at

JavaScriptの falsy(偽として扱われる値) は、全部で次の8種類。
JavaScriptでは falsy以外の値は基本的にすべて truthy です。

false
0
-0
0n
''
null
undefined
NaN

それぞれ
値: 意味
false: 偽
0: 数値のゼロ
-0: マイナスゼロ
0n: BigIntのゼロ
'': 空文字
null: 値がない
undefined: 値が未定義
NaN: 数値ではない

Boolean('')      // false
Boolean('hello') // true
Boolean(0)       // false
Boolean(100)     // true
Boolean([])      // true
Boolean({})      // true
Boolean(true)    // true
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?