?:是可选参数
let func=(param?:String)=>{console.log(param)}
??是比||更为严谨的写法,不会判断0为false
0||1; //10??1; //0
?.等价于“前面的参数&&前面的参数.”
let a={b:1};a?.b?.c //undefined,等价于a&&a.b&&a.b.ca?.b //1,等价于a&&a.ba?.c //undefined,等价于a&&a.c
?:是可选参数
let func=(param?:String)=>{console.log(param)}
??是比||更为严谨的写法,不会判断0为false
0||1; //10??1; //0
?.等价于“前面的参数&&前面的参数.”
let a={b:1};a?.b?.c //undefined,等价于a&&a.b&&a.b.ca?.b //1,等价于a&&a.ba?.c //undefined,等价于a&&a.c