var count={};
for (var i = 0; i < array.length; i++) {
if (count[array[i]]) {
count[array[i]]++;
}else {
count[array[i]]=1;
}
}
for (var key in count) {
if (count.hasOwnProperty(key)) {
console.log(key+':'+count[key]+'times');
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…