0
Why is the BMI result NaN if you use the second prompt to fill out the Height and Weight?
If someone makes an error once while filling out height or weight I want the second height or weight value to override the first in the BMI calculation. Instead the second time around it returns NaN, why? https://code.sololearn.com/W19JYx2vB74E/?ref=app
2 Answers
+ 4
because the prompt is a string and not an integer.
Try to use parseInt(yourPromptVariable);
- 1
Thank you!