举个例子:函数
# 正常建立一个对象 function Super() {}; var s = new Super();
以上其实等价于3个步骤this
# 3个步骤 var s = {}; s.__proto__ = Super.prototype; Super.call(s); # 注:1.2两步,其实就是Object.create(Super.prototype);
var s = {};
s.__proto__ === Super.prototype
# 把s当作Super中的this,作初始化s的操做 Super.call(s);
# 例如 function Super() { this.y = 1; } # 经过 Super.call(s); # 其实就至关于 Super(_this) { _this.y = 1; } Super(s);