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

87
Vistas
Update all objects property value in array

I have array of objects, that I get by array.filter. Now I want to make .map() function on this array and change specific object property in all objects in this array. Something like this

.map(task => task.description = task.description.replace(...);

But this gives me array of strings, not array of objects with this updated property. How to make this returning whole objects with just description updated?

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

0

Avoid to use "=" after arrow function if you do not explicite the return value

Try this :

const test = tasks.map(task => {
  task.description = task.description.replace(...)
  return task
});
console.log(test)
about 4 years ago · Juan Pablo Isaza Denunciar

0

remember that, once you've .filter followed by .map, better to use .reduce() otherwise you'll loop twice on the same array.

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