There is a three-dimensional array with objects, inside which are the values I need. It is necessary to iterate / check several values, and on the basis of this data to collect a two-dimensional array consisting of zeros and ones. During the iteration of the original array, all values are visible as zero. If at each iteration to output an object to the console, then half of the variables are zero, but if you open each (click on it), then everything shows correctly.
Sample code:
this.getG = function() { var grid = []; var i = 0; //this.Area 2х мерный массив объектов Heap for(var y = 0; y < this.Area[i].length; y++) { grid[y] = []; for(var x = 0; x < this.Area[i][y].length; x++) { if(this.Area[i][y][x].ent > 0 || this.Area[i][y][x].flr < 0) { //Сюда не заходит с этими условиями grid[y][x] = 1; //все проверяемые значения нулевые (но это не так) если вывести: console.log(this.Area[i][y][x]); //Выведет Heap> {obj:0, obj2:0} //Но если раскрыть это то все значения на месте } else grid[y][x] = 0; } } return grid; } How do I get to the values I need? Test conditions are schematic.
PS In other browsers the same thing.
PPS That I already tried: and did it an array two-dimensional, and global, and removed inheritance for the class Heap . Any value can be pushed into this array everywhere and read right there, but in another function it will still be zero.