Question: Using the above scripts as models and the JavaScript prompt method, write a simple script that will prompt the user for a number and then

Using the above scripts as models and the JavaScript prompt method, write a simple script that will prompt the user for a number and then reply back to the user that the number is or is not equal to 2. You will need to define a variable with var (the name of the variable is up to you), prompt to get a value into the variable, and then use an if statement to see if the variable is equal to 2. Finally, you can use the alert method to output equal 2 or not equal 2. Some Hints: a. The optional texts chapter 9 covers the prompt method. There are also lots of prompt examples available via Google/Bing. b. The if statement is covered in our main textbook, in the optional text, and in many examples available via Google/Bing. c. If you have never programmed before, this problem might be rather intense. If you run out of time, turn in what you have started for partial credit. In about 2-3 weeks, you will look back and see this problem as trivial. Honest! With Chrome, the correct results from this HTML page and script might look like this:

Using the above scripts as models and the JavaScript prompt method, write

With Chrome, correct results from this HTML page and script might look like

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!