js的call-继承
function fun1() {
this.add = function () { return this.a }
}
function fun2() {
this.sub = function () { return this.a-this.b }
}
function fun3() {
this.a = 10;
this.b = 2;
fun1.call(this);
fun2.call(this);
}
var f3 = new fun3()
alert(f3.add());
alert(f3.sub());

浙公网安备 33010602011771号