JavaScript中的或运算
Expression | Result |
---|---|
true || true | true |
true || false | true |
false || true | true |
false || false | false |
1 || 1 | 1 |
1 || 0 | 1 |
0 || 1 | 1 |
0 || 0 | 0 |
true || 1 | true |
1 || true | 1 |
true || 0 | true |
false || 0 | 0 |
0 || false | false |
false || 1 | 1 |
1 || false | 1 |
null || null | null |
null || false | false |
false || null | null |
null || true | true |
true || null | true |
null || 0 | 0 |
0 || null | null |
null || 1 | 1 |
1 || null | 1 |
undefined || undefined | undefined |
undefined || true | true |
true || undefined | true |
undefined || false | false |
false || undefined | undefined |
undefined || null | null |
null || undefined | undefined |
undefined || 1 | 1 |
1 || undefined | 1 |
undefined || 0 | 0 |
0 || undefined | undefined |
代码:https://files.cnblogs.com/owen-zhang/JavaScript_Or.rar