Javascript - Program the Web
This course covers the basics of programming in Javascript. Work your way through the videos/articles and I'll teach you everything you need to know to make your website more responsive!

2d Arrays & Nested Loops

Lesson 25
Author : Mike Dane
Last Updated : October, 2017


Code

CopynumberGrid = [ [1, 2], [3, 4] ];

numberGrid[0][1] = 99;
document.write(numberGrid[0][0] + "<br>");
document.write(numberGrid[0][1] + "<br>");

for(var i = 0; i < numberGrid.length; i++){
     for(var j = 0; j < numberGrid[i].length; j++){
          document.write(numberGrid[i][j] + ", ");
     }
     document.write("<br>");
}