function solution(arr) { let answer = arr; let result = []; for(let i=0;i<arr.length;i++){ if(result[result.length-1] != answer[i]){ result.push(answer[i]); } } return result; }