JS 中 a || b 和 a ?? b操作

it2026-01-11  7

①a || b 等价于

a ? a : b

②a ?? b 等价于

(a !== undefined && a !== null) ? a : b
最新回复(0)