title: How do I do a array group and count it, like in MySQL group by given column id?
body: <p>I have a large array as bellow, now I need to do a group by first column and count the total of that channel existence.</p>
  
  <p>For example:</p>
  
  <pre><code>var original_db = [
    ["channel1", "online"],
    ["channel2", "offline"],
    ["channel3", "online"],
    ["channel1", "online"],
    ["lot more"]....
  ]
  </code></pre>
  
  <p>Expected result from the original result need to be:</p>
  
  <pre><code>var custom_db = [
    ["channel1", 2], 
    ["channel2", 0],
    ["channel3", 1]
  ]
  </code></pre>
  
  <p>EDIT:</p>
  
  <pre><code>for(var key in original_db) {
      var i;
      for (i = 0; i &lt; original_db.length; i += 1) {
          if (original_db[i][0] === original_db[key][0]) {
              original_db.splice(i, 1);
              return;
          }
      }
  
  }
  
  console.log(original_db); 
  </code></pre>