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

213
Vistas
getting NaN from return function

I'm beginner at JavaScript and I need some help with this. Let's say a user has to enter a number from the HTML form. Then in another function there is a calculation, but when I'm calling the other function I'm getting NaN. This is my function when I'm entering the number, and if I output this I'm getting the calculated result.

const enterNumbers = number => {

    if (number < 10000) {
        return 0.062 * number;
    } else {
        return 0.062 * 20000;
    }

If I output this in a third function let's say

const display = () => {
    console.log (enterNumbers((number)));

I'm getting the result, but then in another function I want to make some calculation with the number calculated from the enterNumbers function

const calculation = () => {
    return enterNumbers * 10;
}

and then when I call the second function in the display function I'm getting a NaN.


about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

What happens if you call?

const calculation = () => {
   return enterNumbers(<ANY_NUMBER_HERE>) * 10;
}
about 4 years ago · Juan Pablo Isaza Denunciar
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