Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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:

image text in transcribed

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions

Question

=+ (b) Do the same for p = 2.

Answered: 1 week ago

Question

1+x signa

Answered: 1 week ago