You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How would you like to enhance the existing project.
In the checkGuess() function, you check if the guessedNumber is a valid number between 1 and 100. However, you don't handle cases where the input is not a number at all. When the user enters a non-numeric value (e.g., letters or symbols) in the input field, the parseInt() function will return NaN, and the game will not provide a useful error message. You may want to add validation to handle non-numeric input gracefully.
Describe breifly how would you implement the same.
To fix the validation issue, you can modify the checkGuess() function. This change ensures that the player receives an error message when they input non-numeric values. Additionally, I've moved the attempts++ statement to all branches of the conditional statement to ensure the attempts are incremented appropriately.
How would you like to enhance the existing project.
In the checkGuess() function, you check if the guessedNumber is a valid number between 1 and 100. However, you don't handle cases where the input is not a number at all. When the user enters a non-numeric value (e.g., letters or symbols) in the input field, the parseInt() function will return NaN, and the game will not provide a useful error message. You may want to add validation to handle non-numeric input gracefully.
Describe breifly how would you implement the same.
To fix the validation issue, you can modify the checkGuess() function. This change ensures that the player receives an error message when they input non-numeric values. Additionally, I've moved the attempts++ statement to all branches of the conditional statement to ensure the attempts are incremented appropriately.
Are you contributing for a program?
GSSoC23
Code of Conduct
The text was updated successfully, but these errors were encountered: