Skip to content
Tutorials Center
My learning

Topics

Lesson 37 of 39 ยท Projects and Practice

Project: Build a Timeline Tool

Build a small JavaScript timeline tool that sorts events, finds gaps, groups them by era and checks cause-and-effect order, using real world history dates.

Historians constantly ask: what happened first, how long between two events, and which period does an event belong to? In this project you will build a small tool that answers those questions for any list of events. You will use real dates from chapters 5 to 8. The code is a stand-in for a real history database, but the thinking is the same.

Step 1: A list of events

Every event has a year, a label and a theme. Putting events into data lets you sort, search and measure them.

JS Step 1: events and sorting

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Step 2: Gaps and spans

A span is the time from first to last. A gap is the time between neighbors. Gaps show where history "speeds up".

JS Step 2: gaps between events

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Step 3: Eras

Historians divide time into periods, though the borders are a matter of convention. Here is a simple set for this course.

Era Years used in this tool
Early modern 1450 to 1750
Age of revolutions and industry 1751 to 1870
Age of empires and world wars 1871 to 1945
Postwar and contemporary 1946 onward
JS Step 3: label eras

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Step 4: Check cause before effect

A cause must come before its effect. This check helps catch mistakes in a timeline or an essay.

JS Step 4: cause-and-effect validator

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Extend it

Try these ideas: add events from chapters 2 to 4; add a "region" field; print only events from one theme; or compute how many events fall in each era. Remember the lesson from the validator: order in time is necessary for causation, but it is not enough. Historians also look for evidence of how one event led to another.

Check your understanding

Quick check ยท 3 questions

of 3 answered You scored / 3 ยท perfect!

  1. 1. In the gaps tool, how do you compute the gap between two events?

    The gap is later year minus earlier year.
  2. 2. Why sort events before computing gaps between neighbors?

    Gaps between neighbors only make sense when events are in chronological order.
  3. 3. If event A comes before event B, what can you conclude?

    Time order is necessary but not sufficient for cause and effect.

Summary

  • Store events as data (year, label, theme) so that they can be sorted and measured.
  • Gaps and spans reveal when history speeds up or slows.
  • Era boundaries are conventions chosen by historians.
  • A validator can check time order, but evidence is needed to show cause.

Next: Practice: Cause and Effect