+ 1
Array JavaScript NaN
I have created an array and for the 14 value it shows NaN. Does anybody know why ?
5 Answers
+ 4
Can you post that code sample of your try, to understand the problem fully..
+ 4
Gamer
The value in the Array at index 14 is ' +"<br />"+"<br />" '. Adding + before a String form value , is converted to a Number . so it's converted equaling is "Not convertible to valid number ", so it saving as NaN -Not a Number ". that's why returning NaN.
Remove + before it.
+ 3
In this case you use a prompt. Then you use the answer from the promt which is a string. Convert the string to a number and then you can use it.
+ 1
Thank you very much. It worked đ
0
Here is the code:
https://code.sololearn.com/WNv9vxyy7m8u/?ref=app