Question: Number guessing game. Write a function expression called numGuesser() that, when run, calculates a random number between 1 and 30 and stores that number. Ask
- Number guessing game. Write a function expression called numGuesser() that, when run, calculates a random number between 1 and 30 and stores that number. Ask the user to enter a guess using the prompt() method. After the user enters a guess, check to see if their guess is correct. If it is, tell the user. If not, tell the user they are incorrect. Add the following items.
- Ensure that the input is numeric. If not, return the string "invalid", and ask them to guess again.
- Limit the number of guesses to 3, at which point the game, stops and displays a game over message.
- For every guess the user makes - if it is too high, let them know. Too low? Let them know that as well. (in the prompt window)
- If the user guesses the correct number, show a confirm() box that tells them that they won and asks if they would like to play again. If they click cancel, use alert() to say "Thanks For Playing" and end the game. If they click ok, start the game all over again.
- Save all of this work in a js file called guessingGame.js. Please attach it to a properly formatted HTML page called guessMe.html.
- Code for all above is commented - header and inline - functions are well commented
- Code for all above is properly aligned and nested, braces are aligned. Variables and page names are named appropriately and lowerCamelCasing is observed.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
