1) reduce 사용
function solution(todo_list, finished) {
return todo_list.reduce((unfinished, task, idx) => {
if (!finished[idx]) {
unfinished.push(task);
}
return unfinished;
}, [])
}
2) filter 사용
function solution(todo_list, finished) {
return todo_list.filter((task, idx) => !finished[idx])
}
function solution(todo_list, finished) {
var answer = [];
for(let i = 0; i<todo_list.length; i++){
if(finished[i]===false){
answer.push(todo_list[i])
}
}
return answer;
}