1// Basic Javascript Nested Loop / 2D Array
2
3for (var x = 0; x < 10; x++) {
4 for (var y = 0; y < 10; y++) {
5 console.log("x: " + x + ", y: " + y);
6 }
7}
1 var arr = [[1,2], [3,4], [5,6]];
2 for (var i=0; i < arr.length; i++) {
3 for (var j=0; j < arr[i].length; j++) {
4 console.log(arr[i][j]);
5 }
6}
1for (let exercise = 1; exercise <= 3; exercise++) {
2 console.log(`---------- Starting exercise ${exercise}`)
3
4 for (let rep = 1; rep <= 6; rep++) {
5 console.log(`Exercise ${exercise}: Lifting weight repetitition ${rep}`);
6 }
7}
1function multiplyAll(arr) {
2 var product = 1;
3 // Only change code below this line
4
5 // Only change code above this line
6 return product;
7}
8
9multiplyAll([[1,2],[3,4],[5,6,7]]);
1//nested for loop
2var arr = [[1,2], [3,4], [5,6]];
3 for (var i = 0; i < arr.length; i++) {
4 for (var j = 0; j < arr[i].length; j++) {
5 console.log(arr[i][j]);
6 }
7}