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

371
Views
¿Cómo tomo valores de varios objetos en formato JSON y los almaceno en una matriz?

Tengo una matriz de objetos en formato JSON:

 [ { "word": "turkey" }, { "word": "tiger" }, { "word": "horse" }, { "word": "pig" }, { "word": "dog" }, { "word": "cat" } ]

Quiero extraer el valor de cada clave de "palabra" y almacenarlo en una matriz como esta:

 let wordsArray = ["turkey", "tiger", "horse", "pig", "dog", "cat"];
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Solo necesitas mapear los valores:

 console.log([ { "word": "turkey" }, { "word": "tiger" }, { "word": "horse" }, { "word": "pig" }, { "word": "dog" }, { "word": "cat" } ].map( ({word}) => word ))

about 4 years ago · Juan Pablo Isaza Report

0

Puede usar Array.map para extraer el valor de la propiedad de la word :

 const arr = [ { "word": "turkey" }, { "word": "tiger" }, { "word": "horse" }, { "word": "pig" }, { "word": "dog" }, { "word": "cat" } ] const res = arr.map(e => e.word); console.log(res);

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!