Skip to content

Commit b9f7660

Browse files
committed
Add deleteCompleted function to the todo.mj
1 parent 03c6296 commit b9f7660

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎Sprint-3/todo-list/todos.mjs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,9 @@ export function toggleCompletedOnTask(todos, taskIndex) {
2626
if (todos[taskIndex]) {
2727
todos[taskIndex].completed = !todos[taskIndex].completed;
2828
}
29-
}
29+
}
30+
31+
// Delete all tasks that are completed
32+
export function deleteCompleted(todos) {
33+
return todos.filter((todo) => !todo.completed);
34+
}

0 commit comments

Comments
 (0)