I did:
a = Array(2).fill([]); a[0].push(1);
Expected outcome: a = [[1], []] Got: a = [[1], [1]]
a = [[1], []]
a = [[1], [1]]
Why does the second item depend on the first one here?
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire