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

226
Views
¿Cómo arreglo la función que regresa antes de tiempo?

Estoy tratando de escribir una función para obtener datos de una base de datos, pero el código de la función no parece ejecutarse de arriba a abajo. Este es mi código:

 function getTextDb(id){ db.get(id).then(function(doc){ console.log("This is what should show: " + doc.text); //Just to show what should be returned return "This is what the return should show: " + doc.text; }); }

pero luego, cuando ejecuto console.log(getTextDb('randomText')) .

 undefined This is what should show: Just some random text

Lo que significa que está regresando antes de llegar a la declaración de devolución real. ¿Qué está pasando?

about 4 years ago · Juan Pablo Isaza
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!