Question: Create a Web (.html) page named evenNumbers.html and an external JavaScript (.js) file named whileLoop.js. In your external JavaScript file, create a while loop that

  1. Create a Web (.html) page named evenNumbers.html and an external JavaScript (.js) file named whileLoop.js. In your external JavaScript file, create a while loop that will write to your Web page every even number above 0 and below 101. These numbers should each appear on a new line. Hint: include a
    element in your document.write() function. In the BODY element of your Web page, create the script element that links your Web page to your external JavaScript file. Test your code.
  2. Create a Web (.html) page named ageChecker.html and an external JavaScript (.js) file named ifElse.js. In your external JavaScript file, use the prompt() function to gather the viewer's age. You may assume that the viewer will enter a number between 5 and 95. Don't forget to use the parseFloat function as you did in your last assignment to ensure that you populate your viewerAge variable with numeric data. Based on the viewer's age, create an if/else statement that will redirect the viewer to http://www.disney.com/ if they are under the age of 21. If they are 21 or older, redirect them to http://www.espn.com/. Test your code.

Hint: use the location property of the window object to redirect the viewer. Example: window.location = "http://www.espn.com/".

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!