I'd like to count the number of each element in my array
Example:
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
}
I'd then like to output
Item | Occurances
--------------------
1 | 2
3 | 1
4 | 2
Thanks in advance