Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
var array = ['box','box','line','time','box']
例:ボックスは数回繰り返されます
どうぞ:
var array = ['box','box','line','time','box'], map = {}, key; array.forEach(function(item) { if (map[item] === undefined) { map[item] = 1; } else { map[item]++; } }); for (key in map) { console.log(" key:", key, " repeated:", map[key]); }