I'm doing a simple Sudoku solver with JavaScript, and there is one problem with adding new values to array. My script makes random length arrays in for..in loop. I have tested this script with Chrome Debugger, and there I see that it loops right count. Did I missed some important point of JS objects, or is the .push() wrong way to do this kind of thing?
this.areaSize = gridSideSize * gridSideSize;
//On progress -data structures
this.structures =
{
rows: new Array(),
columns: new Array(),
parents: new Array()
};
//Fill the data structures with the area object
for(var struct in this.structures)
{
for(var a = 0; a < this.areaSize; a++)
{
var tmp = new PartialArea(this.areaSize);
this.structures[struct].push(tmp);
}
console.log(struct.length);
}
Console tells me, that the first array is 4 items long and the second and the third one are 7 items long.