var arrOri = [2,3,4,5,2,0,3,1] var arr =Array.from(new Set(arrOri)) console.log(arr) var result = arrOri.filter((v, index) =>{ return arrOri.indexOf(v) === index }) console.log(result)