How can i fix when a user Enter a string instant of Entering a number? Help me out! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i fix when a user Enter a string instant of Entering a number? Help me out!

In this code i use only prompt to input from user i can use input box in HTML but this is the challenge. This is my code..... https://code.sololearn.com/WE6jNN7HNg95/?ref=app

30th Jul 2018, 12:29 PM
Chaman Narved
Chaman Narved - avatar
1 Answer
+ 1
Just parseInt() from the prompt and check it for NaN: https://code.sololearn.com/WcrONiYM2QJK/#js
30th Jul 2018, 12:43 PM
Mishin870
Mishin870 - avatar