Question
Ensure that your program conforms to these specs below. Number guessing game. Write a function expression called numGuesser() that, when run, calculates a random number
Ensure that your program conforms to these specs below.
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.
a. Ensure that the input is numeric. If not, return the string "invalid", and ask them to guess again.
b. Limit the number of guesses to 3, at which point the game, stops and displays a game over message.
c. 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)
d. 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.
e. Save all of this work in a js file called guessingGame.js. Please attach it to a properly formatted HTML page called guessMe.html.
f. Code for all above is commented - header and inline - functions are well commented.
g. 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started