JavaScript is a high-level language used here to make functional-programming ideas concrete without treating them as JavaScript-specific rules. Its imperfections encourage careful reasoning, while readable examples keep attention on the underlying design ideas. section 1.29
JavaScript’s runtime gives asynchronous programs a distinctive timeline model:
- Runs one thread, so actions on a single timeline cannot interleave; each action runs to completion. section 15.18
- Uses asynchronous callbacks for input/output, user input, file access, and network calls; each callback creates a new timeline at an unknown future time. section 15.8
- Simplifies timeline diagrams by consolidating actions on one timeline and merging timelines that end by creating a new timeline. section 15.18
A synchronous action sequence
function dinner(food) { cook(food); serve(food); eat(food); } button.addEventListener('click', dinner); section 15.18
function dinner(food) {
cook(food);
serve(food);
eat(food);
}
Inspect the compact dinner listing used to practice consolidating synchronous actions on a JavaScript timeline. section 15.18











