||
const c = a || b
// 当 a 为 null、undefined、false、空字符串和数字0 时就会返回 b 的值
??
const c = a ?? b
// 当 a 为 null、undefined 时就会返回 b 的值
?? 是比 || 更严格更小细粒度的判空
||
const c = a || b
// 当 a 为 null、undefined、false、空字符串和数字0 时就会返回 b 的值
??
const c = a ?? b
// 当 a 为 null、undefined 时就会返回 b 的值
?? 是比 || 更严格更小细粒度的判空