Question
Hey guys, so i'm just starting JavaScript and am lost in this assignment. I know it's relatively simple, but I cant quite figure out how
Hey guys, so i'm just starting JavaScript and am lost in this assignment. I know it's relatively simple, but I cant quite figure out how to write this properly. Any help would be appreciated.
Question 2
/10 Number guessing game. Write a function expression called numGuesser() that, when run, calculates a random number between 1 and 20 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 for more marks.
/5 Ensure that the input is numeric. If not, return the string "invalid", and ask them to guess again.
/5 Limit the number of guesses to 5, at which point the game, stops and displays a game over message.
/5 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)
/5 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 numGuesser.js. Please attach it to a properly formatted HTML page called guess.html.
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