I am making an array of array (a grid) in typescript. I need this array to be 5x4. I am trying to understand how to instantiate it. I know I can do like this for a one dimension array:
let myvar:string[]=new Array(3);
I tried that way but it didn't work when I am trying to push an element. It is saying that my array has 0 line.
export class grid {
public mainGrid: string[][];
public constructor() {
this.mainGrid = new Array<Array<string>(5)>(4);
}
}
Or should I push a new Array(5) for times?