Beginner25 min
BMI calculator
Turn two inputs into a calculated result and a clear validation message.
FormsValidationMath
YOUR BUILD CHECKLIST
- Read height and weight inside the submit handler.
- Reject invalid or zero values before dividing.
- 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 .