@@ -7,20 +7,11 @@ const todos = [];
77
88// Set up tasks to be performed once on page load
99window . addEventListener ( "load" , ( ) => {
10- //get the deleted complete button from html
1110 const massDeleteBtn = document . querySelector ( "#delete-completed-btn" ) ;
1211
13- // check if the button is even found in the HTML
14- // console.log("Button found:", massDeleteBtn);
15-
1612 if ( massDeleteBtn ) {
1713 massDeleteBtn . addEventListener ( "click" , ( ) => {
18- // check if the click event is firing
19- // console.log("Mass delete button clicked!");
20- // console.log("Todos before delete:", JSON.parse(JSON.stringify(todos)));
2114 Todos . deleteCompleted ( todos ) ;
22- // check if the array actually changed
23- // console.log("Todos after delete:", JSON.parse(JSON.stringify(todos)));
2415 render ( ) ;
2516 } ) ;
2617 }
@@ -34,9 +25,8 @@ window.addEventListener("load", () => {
3425 render ( ) ;
3526} ) ;
3627
37-
38- // A callback that reads the task description from an input field and
39- // append a new task to the todo list.
28+ // A callback function that reads the task description from an input field and
29+ // appends a new task to the todo list.
4030function addNewTodo ( ) {
4131 const taskInput = document . getElementById ( "new-task-input" ) ;
4232 const task = taskInput . value . trim ( ) ;
@@ -64,7 +54,6 @@ function render() {
6454 } ) ;
6555}
6656
67-
6857// Note:
6958// - First child of #todo-item-template is a <li> element.
7059// We will create each ToDo list item as a clone of this node.
0 commit comments