// 1 Object.is 判断两个值是否完全相等
// console.log(Object.is(120,121)); // false
// console.log(Object.is(120,120)); // true
// console.log(Object.is(NaN,NaN)); // true
// 2 Object.assign 对象的合并
// const config1 = {
// host:‘localhost‘,
// port:3306,
// name:‘root‘,
// pass:‘root‘,
// test:‘test‘
// }
// const config2 = {
// host:‘http://127.0.0.1‘,
// port:33060,
// name:‘Eric‘,
// pass:‘IloveU‘,
// test2:‘test2‘
// }
// // 后面会把前面的给覆盖
// let res = Object.assign(config1,config2);
// console.log(res);
// 3 Object.setPrototypeOf 设置原型对象 Object.getPrototypeOf 获取原型对象
const city = {
name:‘北京‘
};
const area = {
xiaoqu: [‘朝阳‘,‘海淀‘,‘昌平‘]
};
// 设置原型对象
Object.setPrototypeOf(city,area);
console.log(city);
// 获取原型对象
console.log(Object.getPrototypeOf(city));