在javascript/typescript中,双问号是什么意思?
我看到了这段代码,但不理解这个符号在Javascript或typescript中的含义:在javascript/typescript中,双问号是什么意思?,javascript,typescript,symbols,Javascript,Typescript,Symbols,我看到了这段代码,但不理解这个符号在Javascript或typescript中的含义: const _apolloClient = apolloClient ?? createApolloClient(context); 对像我这样懒惰的人的简短回答: 如果firstValue为null或未定义 console.log(firstValue??secondValue)//secondValue 如果firstValue不是null或未定义 console.log(firstValue??s
const _apolloClient = apolloClient ?? createApolloClient(context);
对像我这样懒惰的人的简短回答:
如果firstValue
为null或未定义
console.log(firstValue??secondValue)//secondValue
如果firstValue
不是null或未定义
console.log(firstValue??secondValue)//firstValue