const arr = [1, 4, 5, 2,7, 3, 7, 7] const Deduplication=(arr)=> { let newarr = [] arr.map(item => { if (!newarr.includes(item)) { newarr.push(item) } }) return newarr } // console.log(Deduplication(arr)) const Deduplication1=(arr)=>{ let newArr=[] return newArr=[...new Set(arr)] } console.log(Deduplication1(arr)) const Deduplication2=(arr)=>{ let newArr=[] return newArr= arr.filter((item, index, arr) => arr.indexOf(item) === index) } console.log(Deduplication2(arr))