title: Find the sum of each row as well as that of each column in 2 dimensional matrix ( m X n)
body: <p>How to find the sum of each row as well as that of each column in 2 dimensional matrix ( m X n).</p>
  
  <pre><code>[
    [1, 2, 3],
    [3, 2, 1]
  ]
  </code></pre>
  
  <p>I know in one dimensional array, we can do:</p>
  
  <pre><code>var sum = [5, 6, 3].reduce(add, 0);
  
  function add(a, b) {
    return a + b;
  }
  
  console.log(sum);
  </code></pre>