-
중복되는 단어 제거코테공부 2021. 7. 9. 21:27
function solution(s){ let answer =[]; s.forEach(value=>{ if(answer.indexOf(value)==-1){ answer.push(value); } }) return answer; } let str=["good", "time", "good", "time", "student"]; console.log(solution(str));
'코테공부' 카테고리의 다른 글
보이는 학생 (0) 2021.07.10 앞의 수보다 큰 수만 출력하기 (0) 2021.07.10 중복되는 글자 제거하기 (0) 2021.07.09 가운데 문자 출력 (0) 2021.07.09 js for문에서 in, of (0) 2021.07.09