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

Why is total NaN?

I can't figure out why total shows up as NaN (not a number) in this code https://code.sololearn.com/WL69y4wzB7Zf/?ref=app

19th Feb 2018, 10:53 PM
jacksonofgames 28
jacksonofgames 28 - avatar
2 Answers
+ 8
You have to assign total variable to 0 in first line of your code. like this =》 var total = 0;
19th Feb 2018, 11:12 PM
UnknownYmous
+ 1
Oh so the variable is identified as numerical. That makes sense. Thanks!
19th Feb 2018, 11:46 PM
jacksonofgames 28
jacksonofgames 28 - avatar