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

140
Vistas
How I can get only active fields false items

my scenario

1 - if I do click the button, I am filtering the array by active field as false, and then updating fields as true.

2 - if I do click second time, I want to get objects with only active fields false.

Result : All items are getting.

JsFiddle link is here

const test  =[
   {firstName:'abc',lastName:'abc',active:false},
   {firstName:'def',lastName:'def',active:false},
   {firstName:'ghi',lastName:'ghi',active:false},
]

document.getElementById('btn').addEventListener('click',()=>{
   const test2 = test.filter(x=>x.active ===false);
        
    console.log(test);
    test2.forEach(x=>{
        x.active=true;
    })
})
<button id="btn">
 Get
</button>

about 4 years ago · Juan Pablo Isaza
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