Boolean() / truthy
Boolean value (true/false).
Syntax
Boolean(value)
Description
0, '' (empty text), null, undefined, NaN are considered 'falsy' (counted as false); everything else is 'truthy'. Used automatically in conditions.
Example
Loading editor…
Expected output
false true false
When to use?
Checking 'is it empty or filled': if (text) { ... }.