title: Why matrix[i+1][j] is not defined?
body: <p>Why matrix in [i+1] is not defined meanwhile it works properly for matrix [i]</p>
  
  <pre><code> function matrixElementsSum(matrix) {
       let x = 0;
       let i = 0;
       let j=0;
       for (i=0; i&lt;matrix.length; i++) {
           for (j=0; j&lt;matrix[i].length; j++) {
  
           if (matrix[i][j] === 0) {
               matrix[i+1][j]=0;
              //Cannot set property '0' of undefined
           }
           x = matrix[i].reduce(function(a,b){return a+b},0);
           x +=x;
        }
  
       }
      return x;
  }
  </code></pre>