let arr = [1,2,3,4,4,5,6]
let b = [...new Set(arr)]
arr.reduce((pre,curr) => {
if(pre[pre.length - 1] === curr) {
return pre
}
pre.push(curr)
return pre
},[])
function D(arr) {
for(let i = arr.length - 1; i > 0; i--) {
if(arr[i] === arr[i-1]) {
arr.splice(i,1)
}
}
}