const a = [1,1,2,2,2,3,4,5,6]
function distinct(arr) {
let re = [];
let pushed = [];
for(let i of arr){
if(!pushed.includes(i)){
re.push(i);
pushed.push(i);
}
}
return re;
}
let b = distinct(a);
console.log(b)