js a??b的操作

787 阅读1分钟

a??b

等价于

(a===undefined||a===null)?b:a

c.a?.b

等价于

c.a && c.a.b

~a.c

等价于

-(a.c+1)