https://jsperf.com/fdgd5t
Рони друг мой
var arr = [], i=1000;
while(i--) arr.push(Math.floor(Math.random() * 1000));
function three(arr){
return arr.filter((function() {
var c = {};
return function(el) {
c[el] = (c[el] || 0) + 1;
return c[el] == 3;
};
})());
}
console.log(three(arr));
Рвет твою
