es5中,生成实例对象通过构造函数来生成:
function Fun(a,b) {
this.a = a;
this.b = b;
}
Fun.prototype.showA = function () {
console.log(this.a)
}
var fun = new Fun(1,2);
fun.showA();//1
function Fun(es5中,生成实例对象通过构造函数来生成:
function Fun(a,b) {
this.a = a;
this.b = b;
}
Fun.prototype.showA = function () {
console.log(this.a)
}
var fun = new Fun(1,2);
fun.showA();//1
function Fun(