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

261
Views
Cómo obtener un valor de una matriz de objetos sin llamar a la clave (he buscado en Internet y no puedo encontrar el problema exacto/similar a este)

Así que tuve este tipo de valor constante

 const testingObjArr = [ { asdasdasdasdds:"testing 123" }, { bcdefghasdkl:"testing 456" }, { asdklqwoepskalx:"testing 678" }, ]

Solo quiero obtener el valor e insertarlo en una nueva matriz como esta

 ["testing 123", "testing 456", "testing 678"]

Intenté usar Object.values y formas similares, pero siempre devolví los mismos valores cuando lo registré.

este es el ultimo metodo que use

 console.log( "testing objs",Object.values(obj).map(i => i).flat())

También uso este bucle para obtener los valores.

 const testingObjArrLength = Object.keys(testingObjArr).length; const finalDatas = []; for(let x=0; x<testingObjArrLength; x++) { const datas = Object.values(testingObjArr)[x] finalDatas.push(datas); } console.log("finaldatas", finalDatas);

Estos son los resultados en el registro de la consola

ingrese la descripción de la imagen aquí

¿alguien puede darme un consejo? agradezco que si no lo etiqueté con duplicado, porque he estado buscando las soluciones

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Puede tomar Array#flatMap con Object.values como devolución de llamada.

 const data = [{ asdasdasdasdds: "testing 123" }, { bcdefghasdkl: "testing 456" }, { asdklqwoepskalx: "testing 678" }], values = data.flatMap(Object.values); console.log(values);

about 4 years ago · Santiago Gelvez 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!