I created an array:
var test = new Array(5);
for (i=0; i<=5; i++)
{
test[i]=new Array(10);
}
And now i want to add object to the field:
test[0][5].push(object);
But appears an error:
Uncaught TypeError: Cannot call method 'push' of undefined
I'm using "push" because I want to put into this field 0-4 objects but I don't know exactly how many object will be there. How should I change it to make it correct?
test[0][5]is returningundefined(since there is nothing in the array living at test[0]) and callingpushon it. I'm not sure I understand what you mean by "I want to put into this field 0-4 objects, but I don't know exactly how many objects will be there".