How can I count the number of occurrences in an array of arrays in JavaScript
<p>How can I count the number of occurrences in an array of arrays?</p>

<p>So I have an array of around 280 arrays, the goals of a soccer team as such:</p>

<pre><code>var goalsScored = [["Sun Apr 28 2009","Juventus - Milan","2 - 3","Del Piero","Dida",7],["Sun Apr 28 1999","Juventus - Milan","2 - 3","Zidane","Peruzzi",44], ["Sat June 8 2009","Juventus - Milan","1 - 0","Nedved","Abbiati",7].....n=280]
</code></pre>

<p>So basically I have a list of goals and I want to count the number of goals scored each minute  where goalsScored[5] refers to the minute. I also want to maintain the data, I don't want to simply count how many goals were scored in the 7th minute, but I would like to know when, by who...etc.</p>

<p>So my question here is how can I do that? And what would be the best data structure? Should I have an array for each minute, or an array of arrays of arrays as such:</p>

<pre><code>goalsMin = [[minute, count[date ,teams, result,scorer, goalkeeper]],[minute,count[date,teams,result,scorer,goalkeeper]]]
</code></pre>

<p>Does that make sense?</p>
