let Arr = [1,2,2,2,3,4,4,5,6,6]; //way1 let unique = [...new Set(Arr)]; console.log(unique); //way2 function removeDuplicate (arr){ return arr.filter((item,index)=> arr.indexOf(item) === index); } removeDuplicate(Arr);