ES5 中prototype作用

2018-04-26  本文已影响0人  adustdu2015

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());

以上就是创建类以及扩展方法的使用细节.

上一篇下一篇

猜你喜欢

热点阅读