title: Jquery Count number of occurances in array
body: <p>I'd like to count the number of each element in my array</p>
  
  <p>Example:</p>
  
  <pre><code> var basketItems = ['1','3','1','4','4'];
  
   jQuery.each(basketItems, function(key,value) {
  
   // Go through each element and tell me how many times it occurs, output this and remove duplicates
  
   }
  </code></pre>
  
  <p>I'd then like to output </p>
  
  <pre><code>Item  |  Occurances
  --------------------
  1     |  2
  3     |  1
  4     |  2
  </code></pre>
  
  <p>Thanks in advance</p>