ES6记录
1、合并两个数组 let a1 = [1,2,3]; let b1 = [2,3,4]; b1 = [...b1,...a1]//[2,3,4,1,2,3] 2、接收数据 let obj = { name:"dengjie", nameList:[{ name:"汤姆" }], }
//前面的字段必须跟返回的obj的字段名一直 let {name:person,nameList:[{name:personName}]} = obj; console.log(person,personName)//dengjie 汤姆