var arr = [9, 9, 9, 111, 5, 2, 5, 3, 4, 4, 5, 7], count = []; for (var i = 0; i < arr.length; i++) { count[arr[i]]= (count[arr[i]] | 0) + 1; } count.forEach(function(item, j, array) { if (item==3) { alert( j ); } });