[JS] Falsy Values
About
A falsy (or falsey) value is a value that's considred false
when encountered in a Boolean context.
Falsy Values in JavaScript
Value
Description
false
The keyword false.
0
The Number zero (so, also 0.0
, etc., and 0x0
).
-0
The Number negative zero (so, also -0.0
, etc., and -0x0
).
0n
""
, ''
, ``
Empty string value.
Objects are falsy if and only if they have the [[IsHTMLDDA]] internal slot. That slot only exists in document.all
and cannot be set using JavaScript.
REF
Last updated