var arr = [9, 9, 9, 111, 5, 2, 3, 4, 4, 5, 5,5,7]; arr=arr.filter((el, i)=> { var s = 0; while (i--) if (el == arr[i]) s++; return (s>1); }); alert(arr)