Morden Javascript Tutorial Chapter 2 - Fundamentals: 11~18
2.11 Logical operators There are four logical operators in JavaScript: || (ORA), && (AND), ! (NOT), ?? (Nullish Coalescing 空值合并). || OR result = a || b There are four logical combinations: alter( true || true ); // true alert( false || true ); // true alert( true || false ); // true alert( false || false ); // false If an operand is not a boolean it’s converted to be a boolean for the evaluation. if (1 || 0) { // works like (true || false) alter('truthy!'); } OR “||” finds the first truthy value result = value1 || value2 || value3 The OR || operator does the following: ...