Skip to content

Instantly share code, notes, and snippets.

View cosmopeon's full-sized avatar

Oleksandr Radzhabov cosmopeon

View GitHub Profile
var brands = ['Nike', 'New Balance', 'Adidas', 'asics', 'Adidas', 'New Balance', 'New Balance', 'Nike', 'Adidas', 'asics'];
var newMap = {};
var max = 1;
var maxItem = brands[0];
brands.forEach(function(item, index, array){
if(!newMap[item]) {
newMap[item] = 1;
} else {
newMap[item]++;