【发布时间】:2014-03-21 11:26:53
【问题描述】:
我想计算数组中每个元素的个数
例子:
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
}
然后我想输出
Item | Occurances
--------------------
1 | 2
3 | 1
4 | 2
提前致谢
【问题讨论】:
标签: jquery