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

283
Vistas
array.includes( () => {} ) as a function

Is there a method like includes that only searches for an element in an array but allows you to see the elements that are being iterating on?

for example: I have the following array:

const arr = [{ color: 'red' },{ color: 'blue' },{ color: 'pink' },{ color: 'green' }]

I want to check if the arr holds an element with the value of pink: so I thought if there's something like this in JavaScript:

arr.includes( (el, index)=> el.color == 'pink' )

which then returns a boolean, either true or false.

Is there a method like that in JavaScript? if not, what about lodash?

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

0

I think you want find:

if (arr.find(el => el.color === "pink")) console.log("it's there");
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