var car = {
model: 'bmw 2018',
engine: {
v6: true,
turbo: true,
vin: 12345
}
}
const modelAndVIN = ({model, engine: {vin}}) => {
console.log(`model: ${model} vin: ${vin}`);
}
modelAndVIN(car); // => model: bmw 2018 vin: 12345
相关文章
- 08-23js之在函数参数中解构嵌套对象
- 08-23JS-比较函数中嵌套函数,可以排序【对象数组】