I am creating a prefilled nested array and want to push elements to specific indexes, but the elements are being added to all indexes.
let arr = new Array(4).fill([])
arr => Array(4) [ [], [], [], [] ] //this is what I want
arr[0].push(3)
arr => Array(4) [ [3], [3], [3], [3] ] //I only wanted to push 3 to first index,
//why do all indexes have this element?
Any help on how to just update one index would be appreciated.