首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

prototype有关测试代码

2013-11-08 
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

?

热点排行