es6 解构

 

for of 迭代和解构,完成写法

 

 

代码简化简写

 

let people =[
  {
    name:'zzh',
    age:18,
    familay:{
      father:'A',
      mather:'B'
    }
  },
  
  {
    name:'lyy',
    age:18,
    familay:{
      father:'C',
      mather:'D'
  },
    
  }
]
for(var {name, age, familay:{father,mather}} of people){
  console.log(name,age,father,mather)
}

 

 

 

posted @ 2020-10-28 15:34  javascript9527  阅读(102)  评论(0编辑  收藏  举报