Lesson Four: More Variables
- You are able to add a variable and assign its value all in the same line.
- Enter this code just above the document.write(event1;) code:
var event2 = "250 Million Years Ago the Dinosaurs Appeared";
- Now substitute the event2 variable for the event1 variable in the document.write()
parenthesis.
- Your code will look like this:
var event1;
event1 = "488 Million Years Ago the Mollusks Appeared";
var event2 = "250 Million Years Ago the Dinosaurs Appeared";
document.write(event2);
- Test your program. The line that previously read: 488 Million Years Ago the Mollusks Appeared now reads:
250 Million Years Ago the Dinosaurs Appeared.
- As you instructed the browser is now using the event2 variable:
- Add this variable code: var event3 = "65 Million Years Ago - Age of the Mammals";. Make the necessary changes to display the new event:
Lesson Five: The if else Conditional Statement