seunghyun Note

[프로그래머스] - 할 일 목록 with JS 본문

코딩테스트/프로그래머스

[프로그래머스] - 할 일 목록 with JS

승숭슝현 2024. 1. 10. 09:34

링크 : https://school.programmers.co.kr/learn/courses/30/lessons/181885

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

문제 풀이

 

오늘부터 다시 JS로 문제를 풀어보자! (코테를 위해..)

오랜만에 사용해서 익숙하지는 않아서 안풀었던 lv0부터 다시!

function solution(todo_list, finished) {
    var answer = [];
    for(let i=0; i<finished.length;i++){
        if(!finished[i]) answer.push(todo_list[i]);
    }
    return answer;
}

 

js의 특징인 간단하게 코드 리뷰가 가능한 것인데.. 내 코드는 형편이 없다.

function solution(todo_list, finished) {
    var answer = [];
    return todo_list.filter((e,i) => !finished[i]);
}
728x90