经测试得出

Ojbect.create() 也就是通过修改 __proto__ 实现的。

例:

var Super = {
say: function() {console.log('say')}
}; // 以下两种方式等价
var Sub1 = Object.create(Super); var Sub2 = {
__proto__: Super
}

Object.create() 和 __proto__ 的关系的更多相关文章

  1. js-new、object.create、bind的模拟实现【转载备忘】

    //创建Person构造函数,参数为name,age function Person(name,age){ this.name = name; this.age = age; } function _ ...

  2. [JS] Topic - Object.create vs new

    故事背景 Ref: 你不知道的javascript之Object.create 和new区别 var Base = function () {} (1) var o1 = new Base(); (2 ...

  3. js学习日记-new Object和Object.create到底干了啥

    function Car () { this.color = "red"; } Car.prototype.sayHi=function(){ console.log('你好') ...

  4. 关于Object.create()与原型链的面试题?

    原文地址 https://segmentfault.com/q/1010000004670616?utm_source=weekly&utm_medium=email&utm_camp ...

  5. 前端开发者进阶之ECMAScript新特性【一】--Object.create

    Object.create(prototype, descriptors) :创建一个具有指定原型且可选择性地包含指定属性的对象 参数:prototype 必需.  要用作原型的对象. 可以为 nul ...

  6. Object.create()和new object()和{}的区别

    Object.create()介绍 Object.create(null) 创建的对象是一个空对象,在该对象上没有继承 Object.prototype 原型链上的属性或者方法,例如:toString ...

  7. javascript Object.create()究竟发生了什么

      这是我在博客园的第一篇博客,早上看了一个大牛的博客,关于javascript继承的,对于大牛使用Object.create()实现继承的方式觉得点问题,就自己研究了一下,所以就有了这篇帖子. 本帖 ...

  8. js Object.create 初探

    1.作用 Object.create()方法创建一个新对象,使用现有的对象来提供新创建的对象的__proto__. https://developer.mozilla.org/zh-CN/docs/W ...

  9. ECMAScript新特性【一】--Object.create

    Object.create(prototype, descriptors) :创建一个具有指定原型且可选择性地包含指定属性的对象 参数: prototype 必需.  要用作原型的对象. 可以为 nu ...

随机推荐

  1. hibernate 连接oracle数据库的配置 (参考)

    <?xml version='1.0' encoding='UTF-8'?><!DOCTYPE hibernate-configuration PUBLIC          &qu ...

  2. jquery mobile 输入框无边框

    现在移动开发为主流的时代,少不了使用jquery mobile.但是偶然应项目要求需要把input输入框做成无边框的,不是特别容易的事,网上找了很多都没有一种靠谱的解决方案,只能自食其力了. < ...

  3. Win7下Hyenae的安装

    (1)下载 链接:http://sourceforge.net/projects/hyenae/   资源:hyenae-0.36-1_fe_0.1-1-win32.exe (2)README --- ...

  4. Large Margin DAGs for Multiclass Classification

    Abstract We present a new learning architecture: the Decision Directed Acyclic Graph (DDAG), which i ...

  5. The Nine Indispensable Rules for HW/SW Debugging 软硬件调试之9条军规

    I read this book in the weekend, and decided to put the book on my nightstand. It's a short and funn ...

  6. String类常用方法小节

    (1)String.equals() 返回值是boolean类型 equals(Object anObject)           将此字符串与指定的对象比较. (2)length() 返回值是in ...

  7. 安卓--界面--改变image view

    switch (v.getId()) { case R.id.button: imageView.setImageResource(R.drawable.jelly_bean); break; def ...

  8. [原]centos6.5系统可用yum源(32位)以及rpmforge

    [10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686 gpgche ...

  9. Linux 路线 推荐

    1.<Linux程序设计>- 靠它来入门,然后装一个linux体系,练习shell(party)和linuxC,把基础打牢: 2. <深入理解Linux内核>和<Linu ...

  10. 开源框架中常用的php函数

    类的自动加载后直接实例化 //自动加载类 function my_autoloader($class) { include $class . 'Class.php'; } spl_autoload_r ...