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

233
Vistas
Use lodash to filter array of objects and check if object property value exists in another Array

I am trying to achieve the following task with lodash or pure JS.

I have an Array of Objects which I filter by a given property value


let res = _.filter(array, {obj.property: "somevalue"}

Now I have another Array like so [val1, val2,val3] which I want the filtered array properties to compare with like so.

let res = _.filter(array, {obj.property1: "somevalue", obj.property2: existsInOtherArray}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use a set and the filter method of array like:

const array = [
  {property1: 'somevalue'},
  {property1: 'somevalue', property2: 'val2'}
]

const set = new Set(['val1', 'val2', 'val3'])
const res = array.filter(obj => obj.property1 === 'somevalue'
                                && set.has(obj.property2))

console.log(res)

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