강의

멘토링

로드맵

Inflearn Community Q&A

leyuri970596's profile image
leyuri970596

asked

Introduction to Javascript Algorithm Problem Solving (Coding Test Preparation)

17. Remove duplicate words

다음과 같이 풀어도 무방할까요?

Written on

·

137

1

        function solution(s) {
            let answer= [];
            for (let x of s) {
                if (answer.indexOf(x) === -1) {
                    answer += x+'\n';
                }
            }
            return answer;
        }
        let str = ["good", "time", "good", "time", "student"];
        console.log(solution(str));

답변 부탁드립니다! ㅠㅠ

코테 준비 같이 해요! javascript

Answer 1

0

codingcamp님의 프로필 이미지
codingcamp
Instructor

안녕하세요^^

네. 잘하신 코드입니다.

leyuri970596's profile image
leyuri970596

asked

Ask a question