Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

84
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!