- 1

NaN error

how to solve NaN error in javascript

23rd Apr 2020, 6:40 PM
Youssef Ashraf
Youssef Ashraf - avatar
3 Antworten
+ 2
NaN means not a number. If you're attempting to do something with a variable that requires it to be of number type and it isn't. This may be your issue. Post your code so we can help.
23rd Apr 2020, 6:42 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Try to use parseInt() or parseFloat() rather than implicit coercion or explicit Number() cast... But as stated by others, you should provide your code to get relevant answers, as without enough context, nobody could help you more than guessing how would it be "solved" ^^ (another way would be to delete the line pointed by the error message: no more NaN error at this location will occur... but your code will not behave as expected, and/or a new error should appears near or far away of this initial error :P)
25th Apr 2020, 4:24 AM
visph
visph - avatar
0
Show me ur code
23rd Apr 2020, 6:41 PM
Abhay
Abhay - avatar