2017
04-01
04-01
一道有价值的JS继承面试题
题目原题目来源于一个网友的问答varA=function(){this.name='apple';}A.prototype.getName=function(){returnthis.name;}//补充代码varB=A.extend({initialize:function(){this.superclass.initialize.call(this);this.total=3;},say:function(){return'我有'+this.total+'个'+this.getName()}});varb=newB();console.log(b.say());/...
继续阅读 >