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

197
Views
no se pueden cambiar los elementos según la identificación y el resultado esperado debe estar en formato de salida y debe devolver el valor adecuado con el valor actualizado

no se pueden cambiar los elementos según la identificación y el resultado esperado debe estar en formato de salida

 const items = [ { id: 1, value: "first" }, { id: 2, value: "second" }, { id: 3, value: "third" } ]; const expectedOutput = [ { id: 1, value: "first" }, { id: 2, value: "newvalue" }, { id: 3, value: "third" } ] function getData(value, id) { return items.map((_each)=> { if(_each.id === id) { //need to update items with id=2 } }) } console.log(getData("newvalue", 2))

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

 const items = [ { id: 1, value: "first" }, { id: 2, value: "second" }, { id: 3, value: "third" } ]; const expectedOutput = [ { id: 1, value: "first" }, { id: 2, value: "newvalue" }, { id: 3, value: "third" } ] function getData(value, id) { return items.map((each)=> { if(each.id === id) { //need to update items with id=2 return {...each, value} }else{ return each } }) } console.log(getData("newvalue", 2))

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!