I'm very lost here. Given a number, n, I have to return an n*n nested array populated with the value null. If n is 3:
[
[null, null, null],
[null, null, null],
[null, null, null]
]
I am so lost. I've got something like this:
function generateMatrix (n) {
let item = 'null';
let array1 = [];
let solution = [];
array1.push(item.repeat(n));
solution.push(array1.repeat(n));
return solution;
}
I know it isn't right, not only because it's not working, but also because it doesn't make sense and I don't know how to do it. Bear in mind I'm very very junior, just started learning JS.
I've seen other similar threads, but can't figure it out.
Thanks in advance.