push to column in 2d array syntax?
-
array[index][index2] = array2[index][index2] works fine, any form of push (array[index].push etc just fails with cannot assign. Any clue on the correct syntax?
-
Here's an example.
const var my2darray = [[],[]]; my2darray[0].push(58); my2darray[0].push(59); my2darray[0].push(60); my2darray[1].push("dog"); my2darray[1].push("cat"); my2darray[1].push("fish"); Console.print(my2darray[1][1]);
-
@d-healey so you have to array.push([]) first if you want to start pushing in to a new end column, that's where the issue was. Cheers!