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

101
Vistas
comparing different values of two arrays and returning one filtered array in JavaScript

I am trying to compare the values of two different arrays, if the user.id of the volunteer iteration matches the id of the userVolunteer iteration, I want that entry to be filtered out of the volunteers array

current attempt:

  const newBirds = volunteers.filter((volunteer) => {
    return volunteer.user_id !== userVolunteers.some((vol) => vol.id)
  });

newBirds currents returns the volunteers array without filtering any of the entries? Any advice?

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

0

You need to put the logic of comparison inside the some callback:

const newBirds = volunteers.filter((volunteer) => {
  return userVolunteers.some((vol) => volunteer.user_id !== vol.id)
});
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