Open sanjarcode opened 7 months ago
$ node Welcome to Node.js v18.16.1. Type ".help" for more information. > x = Array(2).fill(Array(2).fill(0)) [ [ 0, 0 ], [ 0, 0 ] ] > x[0][0] = 3 3 > x [ [ 3, 0 ], [ 3, 0 ] ] > // wtf ;( undefined > x = new Array(2).fill(new Array(2).fill(0)) [ [ 0, 0 ], [ 0, 0 ] ] > x[0][0] = 3 > x [ [ 3, 0 ], [ 3, 0 ] ] >