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

114
Vistas
How to remove multiple array from a oject with index of item from array in Jacascript/Jquery Object?

I have arrayItems on following format:

​Remove elements from in Javascript/jQuery

{images: Array(4) [ "abcd.png", "bcd.jpg", "def.jpg", … ]
​
itemIds: Array(4) [ "1", "3", "2", … ]}

var revid=$(this).attr('data'); 

Above images and itemIds are stored on storedNames by parsing JSONfrom localstorage.

revid returns any values which is on itemIds

This is giving me not a function error:

var indexed = storedNames.findIndex(item => item.itemIds === 'revid');

1 ) How can I find the indexof itemIds in storedNames ? (solved)

​2) How can I remove all item from object(both array) having index value = indexed For example : I want to remove : abcd.png and 1

?

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

0

Thank you @CBroe

I solved this way:

 var indexed = storedNames.itemIds.findIndex(item => item === revid);







 var newObj = {};
 Object.keys(storedNames).forEach(key =>{
  newObj[key]=storedNames[key].filter((item,i) => i !=indexToRemove);
     });
    
  localStorage.setItem("localstorageItems", JSON.stringify(newObj));

Here localstorageItems is the localstorage object having multiple arrays.

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