Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

241
Vistas
Delete all completed items from list and update local storage

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.

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

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)
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda