var obj = {
name:"Jack",
sex:"男",
age:20,
wife:{
name:"Rose",
sex:"女",
age:18,
},
}
var {name:a,sex,wife:{name:c,sex}} = obj;
console.log(a) //jack
console.log(c) //rose
console.log(name) //rose
console.log(sex) //女
console.log(x) //20
var {sex}=obj; //只定义一个时,优先打印最外面的属性值
console.log(sex); //男