📜  javascript 双问号 - Javascript 代码示例

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

代码示例1
let a = null;
const b = a ?? -1;        // Same as b = ( a != null ? a : -1 );
console.log(b);              // output: -1
//OR IF
let a = 9;
const b = a ?? -1;
console.log(b);          // output: 9

//PS.,VERY CLOSE TO '||' OPERATION IN FUNCTION, BY NOT THE SAME