When destructuring nested objects, the interim values are not assigned to consts/variables.(销毁嵌套对象时,不会将中间值分配给const /变量。)
You'll have to assign them explictly:(您必须明确分配它们:)
const animal = {"data":{"typee":{"title":"Cow","legs":4}}}; const { data, // assign the data data: { typee, // assign the typee typee: { title, legs } } } = animal; console.log(data, typee, title, legs);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…