console.log()
pode revelar o comportamento de bugs relacionado à redefinição ou ao não redefinir uma variável. m
linhas e n
colunas de zeros. Infelizmente, ele não está produzindo a saída esperada porque a variável de row
não está sendo reinicializada (definida para uma matriz vazia) no loop externo. Corrigir o código para que ele retorne uma matriz de zeros 3x2 correta, que se parece com [[0, 0], [0, 0], [0, 0]]
. matrix
para um array contendo 3 linhas de 2 colunas de zeros cada.
testString: 'assert(JSON.stringify(matrix) == "[[0,0],[0,0],[0,0]]", "Your code should set the matrix
variable to an array holding 3 rows of 2 columns of zeroes each.");'
- text: A variável da matrix
deve ter 3 linhas.
testString: 'assert(matrix.length == 3, "The matrix
variable should have 3 rows.");'
- text: A variável da matrix
deve ter 2 colunas em cada linha.
testString: 'assert(matrix[0].length == 2 && matrix[1].length === 2 && matrix[2].length === 2, "The matrix
variable should have 2 columns in each row.");'
```