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

68
Views
Asigne una matriz de cadenas y cree propiedades para un objeto en JavaScript

Sé que esta es una pregunta básica, pero estoy tratando de crear una estructura de datos que me desconcierta en este momento.

Tengo una matriz de cadenas así:

 let stringArray = ['Core', 'Regional'];

Y me gustaría crear esta estructura de datos:

 [ {'key': 'Core', 'text': 'Core'}, {'key': 'Regional', 'text': 'Regional'} ]

¿Cómo puedo .map el stringArray para crear la estructura de datos anterior?

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

0

Puedes probar esta solución

 let stringArray = ['Core', 'Regional']; stringArray = stringArray.map(str => ({key: str, text: str})); console.log(stringArray);

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!