Skip to main content

Practice ยท 2 of 2

History Navigation Model

Model pushState/replaceState semantics WITHOUT a browser. Write createHistory() returning { push, replace, back, canBack, current } โ€” current is the latest entry pushed or replaced (null initially); push adds and makes canBack true; replace swaps the top entry WITHOUT changing depth; back moves one entry back and returns it (null at the start).

Difficulty: intermediate

Back to lesson: Practice: URL & History โ€” Practice