Page 188 - JavaScript
P. 188
Chapter 21: Comparison Operations
Remarks
When using boolean coercion, the following values are considered "falsy":
• false
• 0
• "" (empty string)
• null
• undefined
• NaN (not a number, e.g. 0/0)
• document.all¹ (browser context)
Everything else is considered "truthy".
¹ willful violation of the ECMAScript specification
Examples
Logic Operators with Booleans
var x = true,
y = false;
AND
This operator will return true if both of the expressions evaluate to true. This boolean operator will
employ short-circuiting and will not evaluate y if x evaluates to false.
x && y;
This will return false, because y is false.
OR
This operator will return true if one of the two expressions evaluate to true. This boolean operator
will employ short-circuiting and y will not be evaluated if x evaluates to true.
x || y;
This will return true, because x is true.
NOT
https://riptutorial.com/ 145

