在 JS 中,我们需要经常检查对象的某些属性是否存在,然后才能再处理它,不然会报错。早期我们可能会这么干:
如果对象嵌套很深,我们这写法就难以阅读,这时可以使用 ? 来简化:
wx6375cd1abf2fb 博主文章分类:实战技巧 ©著作权
文章标签 可选项 检查对象的某些属性是否存在 嵌套 文章分类 运维
在 JS 中,我们需要经常检查对象的某些属性是否存在,然后才能再处理它,不然会报错。早期我们可能会这么干:
如果对象嵌套很深,我们这写法就难以阅读,这时可以使用 ? 来简化:
上一篇:react中事件对象
下一篇:有状态组件和无状态组件
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M