I am trying to declare variables using for
loop and then test if the cols and rols are the same. If they are, it will run a recursive function. However, I am having trouble doing do in javascript. Can anyone help?
Right now, it says unexpected variable ==
when comparing col.1
and col.2
. I also tried col+j
inside the for
loop, but it was invalid left-hand side assignment
for (var i = 0; i < 2; i++) {
var col = {};
col.i = Math.floor(Math.random() * cols);
col.i = Math.floor(Math.random() * rows);
}
if (col.1 == col.2 && row.1 == row.2) {
return this.getRandomBlock();
}