【发布时间】:2019-03-05 23:52:21
【问题描述】:
我有以下代码示例:
var cobj = {
a: 0,
b: 0,
c: 0,
asdinit: function(x, y, w, h) {
this.a = x;
this.b = y;
this.c = w;
this.h = h;
},
adsfads: function(a, b, c, d) {
this.a = a;
this.b = b;
this.c = c;
}
}
var c = new cobj.asdinit(1, 1, 1, 1);
var bigarray = []
for (t = 0; t < 10; t++) {
var newobj = new cobj.asdinit(1, 1, 1, 1);
bigarray.push(newobj);
}
for (t = 0; t < 10; t++) {
var localobj = bigarray[t];
localobj.adsfads(1, 1, 1, 1);
}
在对象创建时 - 所有函数都可以调用。在从数组中调用之后,函数不可用?
【问题讨论】:
标签: javascript arrays object prototype