mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
987 B
987 B
Exercise
Write updateRemaining function
- Get a reference to the span with the
remainingclass, and store it in a variable - Use querySelectAll to get all of the todos.
- Set the
innerTextof the remaining span to the length of those todos. - Add updateRemaining() to addTodo
Write a clearCompleted function
- Get a reference to all of the todos with querySelectAll
- Use a
for (let todo of todos)loop to iterate over each todo - Inside the for loop write an
ifstatement to test if theinputinside of the todo has a checked value of trueHint: you can use querySelector on any HTML node to find child elements within
- Call
todo.remove()for any todo whos input check is true - After the loop is done, run
updateRemaining() - Attach this function to the footer button
- Test it out!