Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

103
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda