Skip to content
jsworkbench.
All projects
Beginner25 min

BMI calculator

Turn two inputs into a calculated result and a clear validation message.

FormsValidationMath

YOUR BUILD CHECKLIST

  1. Read height and weight inside the submit handler.
  2. Reject invalid or zero values before dividing.
  3. Compare the displayed result with the original formula.
Editable original
Opening editor…
LIVE PREVIEW
Console 0

Your console output appears here.

Saved on this deviceJavaScript · ES2022
Notes on this source port
  • Reject zero height and weight; associate form labels with their original inputs. The original BMI thresholds are retained as coding material.

Make it your own

The original works. These are your next experiments.

  • Preserve decimal input using parseFloat.
  • Move classification into a .
Open a fresh playground