Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

211
Visualizações
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 Respostas
Responde à pergunta

0

What happens if you call?

const calculation = () => {
   return enterNumbers(<ANY_NUMBER_HERE>) * 10;
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda