Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

138
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda