【发布时间】:2022-12-14 22:37:35
【问题描述】:
我正在使用这段代码
data?.response[0]?.Transaction[0]?.UID;
这里 Transaction 密钥不可用,我正在获取
ERROR TypeError: Cannot read properties of undefined (reading '0')
我试图使用 Optional Chaining 检查 null 或 undefined,而不是使用 if 检查它。
【问题讨论】:
-
您能否提供您正在使用的对象的示例蓝图?
标签: javascript typescript