const todos = [
{
id: 1,
text: '함수',
done: true
},
{
id: 2,
text: '객체',
done: true
},
{
id: 3,
text: '배열',
done: false
},
{
id: 4,
text: '배열 내장함수',
done: false
}
]
// done: true 인 값만 구하고 싶을 때
const taskDone = todos.filter(todo => todo.done );
console.log(taskDone);
// done: false 인 값만 구하고 싶을 때
const taskNotDone = todos.filter(todo => !todo.done );
console.log(taskNotDone);