摘要: const a = { b: { c: 'hello world' }};console.log(a?.b?.c); // hello world 阅读全文
posted @ 2021-01-14 10:04 倔强的代码人 阅读(373) 评论(0) 推荐(0) 编辑
摘要: 双问号操作符(??),也被称作空值合并运算符,当左侧的操作数为 null 或者 undefined 时,返回其右侧操作数,否则返回左侧操作数 const foo = null ?? 'default string';console.log(foo); // "default string" 可能有人 阅读全文
posted @ 2021-01-14 10:02 倔强的代码人 阅读(185) 评论(0) 推荐(0) 编辑