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

137
Views
Cómo crear una matriz de objetos con 2 matrices .js

tengo dos matrices

 study_id: ["1", "2", "3"], study_name: ["clinic Study", "study test", "test 2"],

Quiero crear una matriz de objetos con la matriz de la siguiente manera:

 "studies": [{ "study_id": "1", "study_name": "clinic study" }, { "study_id": "2", "study_name": "test study" } ]

¿Cómo lograr esto? Gracias

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

0

hay algunas maneras de hacer esto, pero una solución ES6 es usar el método de mapa en la primera matriz y asignar cada elemento a un objeto cuya clave es el elemento de la primera matriz y el valor es el elemento con el mismo índice en la segunda matriz.

 var a = [1, 2, 3] var b = ['a', 'b', 'c'] var c = a.map((e, i) => { return { [e]: b[i] }; }); console.log(c)

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!