对象扩展

  1. Object.is(v1, v2)
  • 判断2个数据是否完全相等
  1. Object.assign(target, source1, source2..)
  • 将源对象的属性复制到目标对象上
  1. 直接操作 proto 属性
    let obj2 = {};
    obj2.proto = obj1;
    console.log(0 == -0);//true
    console.log(NaN == NaN);//false
    console.log(Object.is(0, -0));//false
    console.log(Object.is(NaN, NaN));//true
        let obj3 = {};
    let obj4 = {money: 5000000};
    obj3.__proto__ = obj4;
    console.log(obj3);//{}obj3为空
    console.log(obj3.money);//5000000

你可能感兴趣的:(对象扩展)