제시된 문제는
function solution(arr){ return arr.filter((val,index) => val != arr[index+1]); }
filter를 사용하고 index를 비교하면서 값을 빼주었다.