I am working on a to-do list project. I want to delete all those items at once which have lines through them by clicking the "clear all completed" button. when I check the box two things happen. First a class by name of "clicked" is added, which does text-decoration: line through. Secondly, It changes the completed boolean from false to true in local storage. you can check the picture below. I am trying to use the filter method, but, I am unsuccessful. Could anyone please help me, how to delete those items at once, along with removing them from local storage too, which have lines through them.
I would save Completed as a boolean value instead of a string, but with your data as it currently stands, here's one way of doing it:
Example
const allTasks = localStorage.getItem('todo-list')
const incompleteTasks = allTasks.filter(task => task.Completed === "false")
localStorage.setItem('todo-list', activeTasks)