I pushed an element into an Array[0] position, however, it did not turned out as I intended. My element ended up at position Array[1], not Array[0]

Viewed 34

My output goal was this: [[4, 1]]

 const num1 = [[1]];

num1[0].push(4);
console.log(num1); //result is [[1, 4]];

``
0 Answers
Related