London | 26-ITP-Jan | Angela McLeary | Sprint 3 | Todo list app - #1141
London | 26-ITP-Jan | Angela McLeary | Sprint 3 | Todo list app#1141AngelaMcLeary wants to merge 4 commits into
Conversation
| <ul id="todo-list" class="todo-list"> | ||
| </ul> | ||
|
|
||
| <!-- i added this --> |
| const massDeleteBtn = document.querySelector("#delete-completed-btn"); | ||
|
|
||
| // check if the button is even found in the HTML | ||
| // console.log("Button found:", massDeleteBtn); |
There was a problem hiding this comment.
It's good practice to remove code, that was used for testing, in the final product
There was a problem hiding this comment.
Hi @Luro91, Thanks for the feedback. I have cleaned the code up.
| } | ||
|
|
||
| #delete-completed-btn:hover { | ||
| background-color: #e74c3c; |
There was a problem hiding this comment.
Hi @Luro91, Thank you for your feedback. I like CSS.
| for (let i = todos.length - 1; i >= 0; i--) { | ||
| if (todos[i].completed) { | ||
| todos.splice(i, 1); | ||
| } | ||
| } |
There was a problem hiding this comment.
The code works correctly.
You can also research build in array functions. There is one that allows you to filter elements from an array based on a condition
There was a problem hiding this comment.
Hi @Luro91, Thank you for your feedback. I have researched it and found that using filter() makes the functions cleaner. I have also updated the code.
|
Well done 👍 |
|
Closing PR because the January ITP run has finished. Feel free to re-open if you're still working on it. |
Learners, PR Template
Self checklist
Changelist
This PR is about a todo list whixh updates when you add an item to the list and once completed you are able to delete the completed items.