Count how many strings in an array have duplicates in the same array
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/8607455/array-value-count-javascript">Array value count javascript</a>  </p>
</blockquote>



<p>I have an array which contains several duplicates, what I'm trying to achieve is to count how many duplicates each unique string has in this one array.</p>

<p>The array looks something like this</p>

<pre><code>array = ['aa','bb','cc','aa','ss','aa','bb'];
</code></pre>

<p>Thus I would like to do something like this</p>

<pre><code>if (xWordOccurrences &gt;= 5) {
    // do something
}
</code></pre>

<p>But I'm not sure how I would code this.
I was thinking, create an object with each unique string, then loop through the original array, match each string with it's object and increment it's number by 1, then loop over the object to see which words had the most duplicates... </p>

<p>But this seems like an over complexe way to do it.</p>
