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

111
Views
La variable global no cambia js
function get_info() { var temp; con.connect(function (err) { if (err) throw err; con.query("SELECT * FROM customers", function (err, result, fields) { if (err) throw err; temp = result; console.log(temp); }); }); console.log(temp); }

cuando ejecuto la función, el console.log(temp) al final de la función muestra "indefinido" aunque muestra los datos cuando hago console.log(temp) en la función interna. Creo que el problema es que la variable global no cambia, pero no sé cómo solucionarlo. ¿Algunas ideas?

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!