console.log()
can uncover buggy behavior related to resetting, or failing to reset a variable.
m
rows and n
columns of zeroes. Unfortunately, it's not producing the expected output because the row
variable isn't being reinitialized (set back to an empty array) in the outer loop. Fix the code so it returns a correct 3x2 array of zeroes, which looks like [[0, 0], [0, 0], [0, 0]]
.
matrix
variable to an array holding 3 rows of 2 columns of zeroes each.
testString: assert(JSON.stringify(matrix) == "[[0,0],[0,0],[0,0]]");
- text: The matrix
variable should have 3 rows.
testString: assert(matrix.length == 3);
- text: The matrix
variable should have 2 columns in each row.
testString: assert(matrix[0].length == 2 && matrix[1].length === 2 && matrix[2].length === 2);
```