var arr = new Array(10000).fill(1)
let threeF = arr => arr.filter(el => {
this[el] = ++this[el] || 1;
return 3 === this[el]
}, {})
console.time("x")
var x = threeF(arr);
console.timeEnd("x")
function fn(d, e) {
for (var f = [], b = {}, a, c = 0; c < d.length; c++)
a = d[c], b[a] == e || (b[a]++ || (b[a] = 1), b[a] == e && f.push(a));
return f
};
console.time("k")
var k = fn(arr,3);
console.timeEnd("k")