Skip to content

Instantly share code, notes, and snippets.

View cosmopeon's full-sized avatar

Oleksandr Radzhabov cosmopeon

View GitHub Profile
function mostCommon (array) {
return array
.filter(function (value, index, array) {
return array.indexOf(value) === index;
})
.map(function(uniqueItem) {
var count = 0;
array.forEach(function(item) {
if (uniqueItem === item) {