prototype有关测试代码

prototype相关测试代码function A () {this.foo function () {}}A.prototype.bar function () {}funct

prototype相关测试代码

  function A () {      this.foo = function () {}  }  A.prototype.bar = function () {}  function B(){}  B.prototype = new A();  var a = new A();  var b = new B()  console.log(b.__proto__===B.prototype)    // true  console.log(b.foo===a.foo)                // false  console.log(b.bar===a.bar)                // true  console.log(B.prototype===A.prototype)    // false

?