Below code works absolutely fine using JavaScript. I can print cell[5] in other words any specified index value. But I want to print this in a loop but it does not work. Does any one know why it does not work.
$(document).ready(function () {
var grid_arr = new Array();
var count = 0;
var cell;
cell = {
x1: 10,
y1: 10
};
alert(cell.x1);
for (i = 1; i < 10; i++) {
cell[i] = {
x1: i * 5,
y1: i * 2
};
}
alert(cell[5].x1);
});
/* The below for loop does not display any messages: */
for (var j = 0; j < 9; j++) {
alert(cell[j].x1);
}
[]tonew Array()$(document).ready?for (i = 1; i < 10; i++) {why start from 1 ?