Visualisation for a 2 dimensional array of objects' variable

Viewed 23

What I want to do is display a 2 dimensional array (1 array containing other arrays as its items) full of objects. But instead of showing its object name, I want to display a specific variable of each object, namely "status". so in the end i'd be able to display a table of 1s and 0s of each object which represent something for what I'm trying to make. The reason I want this is to help me in making a maze generator. Visualisation basically.

class Node{
  constructor(up,down,right,left,status)
  {
    this.up = up;
    this.down = down;
    this.right = right;
    this.left = left;
    this.status = status;
  }
}
let Node00 = new Node(1,1,1,1,1);
var size = 16;

var theArray = [];
var arrayElement = [];
for (var y = 0; y < size; y++){
  arrayElement.push();
  arrayElement[y] = new Node(1,1,1,1,1);
}
for (var i = 0; i < size; i++){
  theArray[i] = arrayElement.concat();
}
console.table(theArray);
console.table(arrayElement,["status"]);

0 Answers
Related