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

169
Views
obtener un valor único al regresar en el nodo js/javascript

Estoy tratando de devolver el valor de mi función de cliente, pero el problema es que obtengo un valor único

detalles del cliente.js

 function customerDetails(obj, customerId) { let type, access_id, info, entry_available; for (i = 0; customerId[obj.data.target.sys.id].locale.length > i; i++) for (const detail of customerId[obj.data.target.sys.id].locale) { type = obj.member; access_id = obj.id.replace(/-/g, "_"); info = obj.info; entry_available = {}; if (obj.data.target.sys.id in customerId) { entry_available = { "customer-id": obj.data.target.sys.id, locale: detail, "shop-id": customerId[obj.data.target.sys.id].shop_id, }; } // console.log( access_id, type, entry_available, info ); // here I am getting all the values return { access_id, type, entry_available, info }; } }

así que aquí puede ver el lugar donde estoy escribiendo console.log(). Obtengo todos los valores allí, así que devuelvo el valor porque quiero devolverlo exactamente de la misma manera, pero devuelve un valor único. ¿Hay alguna forma posible de devolverlo todo? los valores que obtengo en el mismo formato?

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

0

suponiendo que desea que sus valores se devuelvan en variables individuales:

no hay forma de devolver múltiples valores sin formato en javascript como es posible, creo, python, pero puede usar la desestructuración para su ventaja.

 function customerDetails ( obj, customerId ) { let type, id, info; // ... return { type, id, info }; } const { type, id, info } = customerDetails(/* ... */);

lea más sobre la desestructuración aquí

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!