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

20th Apr 2017, 7:16 PM
AceDev
2 odpowiedzi
+ 4
because the prompt is a string and not an integer. Try to use parseInt(yourPromptVariable);
20th Apr 2017, 7:29 PM
Max_N
Max_N - avatar
- 1
Thank you!
20th Apr 2017, 8:13 PM
AceDev