var arr = [1, 2, 1, 4, 3, 4, 2, 6, 8];
var newArr=[];
for(var i = 0; i < arr.length; i++) {
if(newArr.indexOf(arr[i]) < 0) {
newArr.push(arr[i])
}
}
console.log(newArr);
var arr = [1, 2, 1, 4, 3, 4, 2, 6, 8];
var newArr=[];
for(var i = 0; i < arr.length; i++) {
if(newArr.indexOf(arr[i]) < 0) {
newArr.push(arr[i])
}
}
console.log(newArr);