合并对象属性

  • ES6的 Object.assign() 也可以达到相似效果
let obj1 = {
  age: 110,
  name: "LLC"
}
let obj2 = {
  gender: "meal"
}
let obj3 = {
  talent: ['eat', 'talk']
}
let obj  ={...obj1, ...obj2, ...obj3};
console.log(obj);  //{ age: 110, name: 'LLC', gender: 'meal', talent: [ 'eat', 'talk' ] }