Lesson Four: More Variables

  1. You are able to add a variable and assign its value all in the same line.
  2. Enter this code just above the document.write(event1;) code:
    var event2 = "250 Million Years Ago the Dinosaurs Appeared";


  3. Now substitute the event2 variable for the event1 variable in the document.write()
    parenthesis.
  4. 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);


  5. Test your program. The line that previously read: 488 Million Years Ago the Mollusks Appeared now reads:
    250 Million Years Ago the Dinosaurs Appeared.
  6. As you instructed the browser is now using the event2 variable: Sample
  7. Add this variable code: var event3 = "65 Million Years Ago - Age of the Mammals";. Make the necessary changes to display the new event: Sample

Lesson Five: The if else Conditional Statement