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

302
Views
NaN showing instead of calculation from node js (express) back end

i m just learning express and node js and i was making bmi calculator. every thing is just as the tutorial but my result is getting NaN instead of calculation heres the code

node js
app.get("/bmiCalculator", (req, res) => {
    res.sendFile(__dirname + "/bmiCalculator.html")
})
app.post("/bmiCalculator", (req, res) => {
    var w = parseFloat(req.body.weight)
    var h = parseFloat(req.body.height)
    var bmi = w / (h * h);
    res.send("your bmi is " + bmi)
})


html
</head>
<h1>bmi cal</h1>

<body>
    <form action="/bmiCalculator" method="post">
        <input type="text" placeholder="weight">
        <input type="text" placeholder="height">
        <button type="submit">bmi calculate</button>
    </form>
</body>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Isn't it just that your form fields are missing a name attribute?

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!