function f1() { this.a = 1; this.b = [1, 2, this.a]; this.show = function(){ console.log(this.b) } } function f2() { this.a = 2; } f2.prototype = new f1(); var a2 = new f2(); a2.a = 10; console.log(a2.show()); //[1,2,1]?
2 回答
米琪卡哇伊
TA贡献1998条经验 获得超6个赞
数组存的不是变量
var a = [], b = 1;
a[0] = b;
console.log(a);//[1]
b = 2;
console.log(a); //[1]
添加回答
举报
0/150
提交
取消
