Am I correct in assuming that when the first if statement and nested if within the else statement both fail, I then go back up to the first for loop and increment i by 1?
So I can continue until j < totalCols fails even though neither the if or else statement are executing?
var rowCount = [];
for (var i = 0; i < totalRows; i++) {
rowCount[i]="";
spaceCount = 0;
for (var j = 0; j < totalCols; j++) {
if (puzzle[i][j] == "#") { // if this fails?
spaceCount++;
if (j == totalCols-1) rowCount[i] += spaceCount + " ";
} else {
if (spaceCount > 0) { //and this fails?
rowCount[i] += spaceCount + " ";
spaceCount = 0;
}
}
}
}