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

107
Views
Why this value is not changing when console logging it. Its showing 0 0
let roomLength = 0
let studentLength = 0
    db.query("SELECT * FROM rooms", (err, result)=>{
    if(err){
        console.log(err);
    }else{
        roomLength = result.length
    }
})

db.query("SELECT * FROM student", (err, result)=>{
    if(err){
        console.log(err);
    }else{
       studentLength = result.length
    }
})

console.log(roomLength, studentLength)

The studentLength and roomLength is showinh as 0 0 when logging it outside of the db.query function. But its working fine when adding console.log inside db.query

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!