Object.assign 对象的合并
<script> // Object.assign 对象的合并 const config1={ host:'localhost', port:3306, name:'root', pass:'root', test:'test' } const config2={ host:'http://atguigu.com', port:3306, name:'asd das ', pass:'tessss', } console.log(Object.assign(config1,config2)); // 合并起来如果名字重复后面的会覆盖前面的 </script>
Object.setPrototypeOf 设置获取原型对象
const school = { name:'王老五' } const cities = { xiaoqu:['北京','上海','大连'] } Object.setPrototypeOf(school,cities) console.log(school);
获取原型
// 获取原型 console.log(Object.getPrototypeOf(school));
标签:ES6,school,const,log,对象,Object,扩展,console,name From: https://www.cnblogs.com/0722tian/p/17137158.html