Why it is returning NaN? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why it is returning NaN?

I'm making a Fahrenheit to Celsius converter. But my code is returning NaN. What am I doing wrong? https://code.sololearn.com/Wmyr8bdFy1P3/?ref=app

27th Aug 2021, 6:47 AM
Ahnaf Sadaf
Ahnaf Sadaf - avatar
3 Answers
+ 1
try this var fahrenheit = document.getElementById('fahrenheit').value; there is no need to give double Quotation for example : var fa = "document.getElementById('fahrenheit').value" output: document.getElementById('fahrenheit').value; var fa = document.getElementById('fahrenheit').value output: (Entered value will be the Output )
27th Aug 2021, 6:57 AM
Pariket Thakur
Pariket Thakur - avatar
+ 2
Remove the double quotes from the variable fahrenheit declaration.
27th Aug 2021, 6:59 AM
HBhZ_C
HBhZ_C - avatar
0
Thanks guys. It really helps 😊
29th Aug 2021, 10:37 AM
Ahnaf Sadaf
Ahnaf Sadaf - avatar