1-1 Object.assign

作用:给对象添加新的属性;

  1. var obj = {name:"cheng"};
  2. Object.assign(obj,{age:18});
  3. console.log(obj);