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

128
Views
Iterando a través de la propiedad del objeto y colocando los valores dentro de las variables en javascript

Estoy tratando de iterar a través de un objeto usando el bucle for...in para obtener los valores de todas sus propiedades y colocarlas dentro de las variables. Estoy tropezando con esto.

Lo que me gustaría hacer es recorrer las propiedades del objeto, poner el value dentro de una variable del mismo nombre que la property para usar en otra variable

 somePromise.then(response => { for (let property in response) { property = response[property] // this doesn't work cause reuses the same variable } /// I take the value of each property from the loop and pass it down user.updateInfoFromOldDB( userID, nguid, property1 property2, property3 property4, ) ...ommited_code })
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

¿Probaste Object.values()?

 somePromise.then(response => { const valuesArr = Object.values(response); /// I take the value of each property from the loop and pass it down user.updateInfoFromOldDB( ...valuesArr ) ...ommited_code })
about 4 years ago · Juan Pablo Isaza Report

0

Puede acceder directamente a las propiedades desde la respuesta:

 somePromise.then(response => { user.updateInfoFromOldDB( response.userID, response.nguid, response.property1, response.property2, response.property3 response.property4, ) })
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!