This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]++; |