【发布时间】:2017-12-14 15:55:46
【问题描述】:
如果对象已定义,我如何才能解构它?
const {url} = image; // only destructure if image is defined.
// don't want to nest the destructuring in if image condition
【问题讨论】:
-
if (image) { const {url} = image; } -
您的意思是仅在定义或声明时?
标签: javascript ecmascript-6 destructuring