๋ฌธ์ ๐ฝ
https://school.programmers.co.kr/learn/courses/30/lessons/12906
๋ค๋ฅธ์ฌ๋ ํ์ด ๐ฝ
function solution(arr)
{
return arr.filter((val,index) => val != arr[index+1]);
}
๋ดํ์ด๐ฝ
1. ์ฑ๊ณต โญ
function solution(arr){
let answer=[]
arr.forEach((val,index)=>{
if(val!==arr[index+1]) answer.push(val)
})
return answer
}
๋๋์ ๐ฝ
์ด๋ ต์ง ์๊ฒ ๊ฐ๋ฅํ๋ค