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

110
Views
Matriz modificada de objeto con valor de un objeto dado TS/JS

Chicos, ¿cuál es el mejor enfoque para la matriz modificada de objetos con valor del objeto? Por ejemplo: digamos que tenemos una matriz y un objeto como este:

 let arr = [ { parameter: 'aaa', isSomething: false }, { parameter: 'bbb', isSomething: false }, { parameter: 'ccc', isSomething: false } ]; let obj = {aaa: false, bbb: true, ccc: true}

y la salida que quiero lograr es:

 let arr = [ { parameter: 'aaa', isSomething: false }, { parameter: 'bbb', isSomething: true }, { parameter: 'ccc', isSomething: true } ];

¿Podrías ayudarme con este? Agradecería. Gracias

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

0

Puede usar Arra#map() combinado con la asignación de Destructuring

Código:

 const arr = [{parameter: 'aaa',isSomething: false},{parameter: 'bbb',isSomething: false},{parameter: 'ccc',isSomething: false}] const obj = { aaa: false, bbb: true, ccc: true } const result = arr.map(({ parameter, isSomething }) => ({ parameter, isSomething: obj[parameter] })) console.log(result)

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!