Here is the test code that I am using:
console.log('AA',slider);
console.log('AB',slider.length);
When I check the Chrome console, it shows the following results.
AA Array[53]
AB 0
I included this test code because even though there seems to be a value present, slider[5]
always returns as undefined
.
Here is a basic version of the initialization script. The complete code is lengthy and Slider is an object being used. This code sets up the Slider object and later on, further manipulation is done based on data retrieved via AJAX.
var slider=[];
for (var uid=1;uid<50;uid++) {
slider[uid]=new Slider(.........);
}
var slider={};
for (var uid=1;uid<50;uid++) {
slider[uid]=new Slider(.........);
}
This then outputs AA { 1:{m a: ...., b: ...., c: ...., g: ...., h: .... }, 2: .....
It goes through this process all the way up to number 49