js中“??“和“?.“怎么用?

??:空值合并操作符 逻辑操作符,左侧为null和undefined时,才返回右侧的数const sum = null ?? 12console.log(sum);//输出12const sum1 = 12 ?? 23console.log(sum1);//输出12const sum2 = unde
posted @ 2022-06-23 11:27  喆星高照  阅读(230)  评论(0编辑  收藏  举报