title: 2d array diagonally filling
body: <pre><code>1 2 3
  4 5 6
  7 8 9
  </code></pre>
  
  <p>this is my normal array, but i need to make it diagonally like this </p>
  
  <pre><code>1 2 4
  3 5 7
  6 8 9
  </code></pre>
  
  <p>this is very stupid way to make it work, but even it is not working because i am not able to find 2nd column elements. </p>
  
  <pre><code>for (i = 0; i &lt; arr.length; ++i) {
      for (n = 0; n &lt; arr[0].length; ++n) {
          if (i == 0 &amp;&amp; n == 0){
              arr[i][n] = 0;
          } else if (i == 0 &amp;&amp; n == 1) {
              arr[i][n] = 2;
          } else if (i == 1 &amp;&amp; n == 0) {
              arr[i][n] = 3;
          } else if (n == 0) {
              arr[i][n] = arr[i - 1][n] - arr[i - 2][n] + 1 + arr[i - 1][n];
          } else {
              arr[i][n] = arr[i][n - 1] - arr[i][n - 2] + 1 + arr[i][n - 1];
          }
      }
  }
  </code></pre>