function Obj(){
this.name ="aaaa";
this.say = function(){
console.log('say');
}
}
Obj.prototype.getApp = funcion(){
return 'App';
}
var app = new Obj();
console.log(app.getApp());
以上就是创建类以及扩展方法的使用细节.
function Obj(){
this.name ="aaaa";
this.say = function(){
console.log('say');
}
}
Obj.prototype.getApp = funcion(){
return 'App';
}
var app = new Obj();
console.log(app.getApp());
以上就是创建类以及扩展方法的使用细节.
本文标题:ES5 中prototype作用
本文链接:https://www.haomeiwen.com/subject/zrzplftx.html
网友评论