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

137
Views
How do I access the return of a parameter function in js?

I am making some Node.js backend code that will read some data from a database, and I need to get the results from the database query, but I don't know how to do that, or if there even is a way to do it. Here is my code that queries:

db.query(sql, (err, rows) => {
        if (err) throw err;

        console.log();
        return rows[0]['COUNT(*)'];
    })

Also, I am using the MySQL library, and this is the whole function:

LengthOfTable: function (tableName = string) {
    sql = `SELECT COUNT(*) from ${tableName}`;

    db.query(sql, (err, rows) => {
        if (err) throw err;

        console.log();
        return rows[0]['COUNT(*)'];
    })
}
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!