"Hashを使ってユニークにしよう!" を JavaScript で.

http://perl-mongers.org/2008/06/hash.html

var cars = ["honda", "honda", "suzuki", "toyota", "toyota", "daihatu", "mitubishi"];

var report = {};
cars.forEach(function(car) {
    report[car] = ++report[car] || 1;
});

for(var i in report) {
    print(i + ": " + report[i]);
}


これでおk?