I was trying to push a new value to a nested array in javascript but something went wrong.
let bucket = new Array(10).fill([]);
bucket[0]= [1,2]
bucket[1].push(3);
console.log(bucket);
and then I got this result
[
[
1,
2
],
[
3
],
[
3
],
[
3
],
[
3
],
[
3
],
[
3
],
[
3
],
[
3
],
[
3
]
]
I don't get it. Why did it push to all the empty nested arrays, is there some documentation for this? And how can I push a value to a nested value otherwise?