topic description
I want to create a two-dimensional array and then add a value to a subarray like
var arr33 = [[1dje 2rect 3], [1jre 2pr 3], [1pr 2je 3]
get:
var arr33 = [1m et 2rect 3], [1m re 2rect 3je 4], [1je 2je 3]
implementation method
var arr33 = new Array(3).fill([1,2,3]);
arr33[1].push(4)
console.log(arr33);
result
the output of the result is not [[1mage2pje 3], [1pje 2pje 3pje 4], [1je 2je 3 pas 3]
, but [[1mie 2pr 3pr 4], [1pr 2pr 3p4]
, why is this?