How to check if input is a number and call a function accordingly?

前端 未结 3 1051
不知归路
不知归路 2021-01-24 08:30

I have my code below..I need to modify it so that the input is checked if it is number.If its not a number, then a message has to be displayed as follows \" please enter only no

3条回答
  •  遥遥无期
    2021-01-24 09:35

    parseInt has to be used with both entered_num and generated_num, right now you are doing only for one.

    
    Guessing Game
     
    
        
    
       
       
    Guess a number between 1 and 1000:

提交回复
热议问题