javascript create matrix

Solutions on MaxInterview for javascript create matrix by the best coders in the world

showing results for - "javascript create matrix"
Julian
03 Sep 2019
1// this will create a 2D array of 'none' word
2var size = 3;
3var myArray = Array(size).fill( Array(size).fill("none") );
4
5console.log(myArray);
6/*
7[
8	["none", "none", "none"],
9	["none", "none", "none"],
10	["none", "none", "none"]
11]
12*/