Use caution when Reinitializing variables inside a loop, new(1)

I somehow solved solved the challenge where it required that the code is to return a 2D array na dmy solution worked.

here it is:

 for (let j = 0; j < n; j++) {
      row = [0];

I decided to put the row inside the inner iteration and it worked and looking at the freecodecamp’s solution it is not a match.

could there be a problem arising from the solution I have given because I seem to get none.

your function is not reusable

try to call matrix(3,3)
you should get [[0,0,0],[0,0,0],[0,0,0]]

your function doesn’t output that

when you have a question please include challenge link, and your whole code