摘要: const user = { profile: { name: '张三' } }; const userName = user.profile?.name ?? '匿名'; // 结果: userName = '张三' 此代码首先演示了如何使用可选链运算符 (?.) 安全地访问user.profil 阅读全文
posted @ 2024-07-08 14:10 你风致 阅读(1) 评论(0) 推荐(0) 编辑