The browser storage localStorage is not available. Either your browser does not support it or you have disabled it or the maximum memory size is exceeded. Without localStorage your solutions will not be stored.

Nested loops

Loops can be nested into each other. In case of a for loop you have to use two different loop variables.
var a = [[1, 7, 3], [2, 8, 5], [9, 0, 4]];
var sum = 0;
for (var i = 0; i < 3; i++) {
  for (var j = 0; j < 3; j++) {
    sum = sum + a[i][j];
  }
}
The code snippet calculates the sum of all elements of a two-dimensional array.

Exercise

Write a function sum that calculates the sum of all elements of a two-dimensional array. sum([[1, 2], [3]]) should return 6.