ES5中prototype的应用, 在JS中,函数同时也是一个对象, 向这个函数对象中添加属性及函数可使用prototype这个属性
<script type="text/javascript">
function Obj(){
this.name ="南昌雅腾";
this.success = function(){
console.log('成功');
}
}
Obj.prototype.address = "南昌艾溪湖边上";
Obj.prototype.getName = function(){
return this.name;
}
var app = new Obj();
console.log(app.getName());
</script>