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

203
Views
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 answers
Answer question

0

What happens if you call?

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