📜  javascript 运算符双管道 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:41.456000             🧑  作者: Mango

代码示例1
// Returns the right-hand operand if the left-hand is 0, false, empty string{, null, undefined or NaN
0 || "other" // "other"
false || "other" // "other"
"" || "other" // "other"
null || "other" // "other"
undefined || "other" // "other"
NaN || "other" // "other"

({}) || "other" // {}
[] || "other" // []