js基础篇--对象

1、建立对象

   对象直接量和 new Object (构造函数)与  Object.create 建立对象的区别函数

    一、对象直接量和 new Object (构造函数)  原型都是Object 的 prototypeprototype

    二、Object.create 能够实现继承,能够传入任意原型建立新对象对象

      let o1 = Object.create({x:1, y:2});   =>  o1 继承了 x 和 y 的属性继承

      let O2 = Object.create(null)   => O2 不继承任何属性和方法原型

      let O3 = Object.create(Object.prototype);  =>  做用和对象直接量及new 建立对象同样构造函数

2、

相关文章
相关标签/搜索