title: Javascript Array Map 2D array
body: <p>I'm trying to aggregate the array (arr) below so that I get an output such as: </p>
  
  <p><strong>Desired Output:</strong> [['2011-04-11','Open',6],['2011-04-11','Closed',4]]</p>
  
  <p>but I'm getting:
  <strong>Output:</strong> [2011-04-11,Open: 6, 2011-04-11,Closed: 4] </p>
  
  <p>How can I take the javascript array map and convert to desired out.</p>
  
  <p><strong>Source code excerpt:</strong></p>
  
  <pre><code>var arr = [
      ['2011-04-11', 'Open'],
      ['2011-04-11', 'Closed'],
      ['2011-04-11', 'Closed'],
      ['2011-04-11', 'Open'],
      ['2011-04-11', 'Open'],
      ['2011-04-11', 'Open'],
      ['2011-04-11', 'Closed'],
      ['2011-04-11', 'Closed'],
      ['2011-04-11', 'Open'],
      ['2011-04-11', 'Open']
  ];
  
  var hist = [];
  arr.map(function(a) {
     if (a in hist)
        hist[a]++;
     else
        hist[a] = 1;
  });
  </code></pre>