let arr = [1.2,3,3,4,4,5,6,56,12,12];
const unque = arr=>{
let newArr = [];
arr.forEach(element => {
if(newArr.indexOf(element) < 0){
newArr.push(element);
}
});
return newArr;
}
console.log(unque(arr));
网友评论