Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

  1. 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.
    1. Ensure that the input is numeric. If not, return the string "invalid", and ask them to guess again.
    2. Limit the number of guesses to 3, at which point the game, stops and displays a game over message.
    3. 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)
    4. 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.
    5. Save all of this work in a js file called guessingGame.js. Please attach it to a properly formatted HTML page called guessMe.html.
    6. Code for all above is commented - header and inline - functions are well commented
    7. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions