Aabha · Learn by building

Explained solution 10: Finish with honest persistence

A: the host is part of an origin, so localhost and 127.0.0.1 do not share that storage area even when they reach the same machine. A different port also changes it. The demo has no reason to keep personal details and provides no real service; event IDs are sufficient for its bounded shortlist feature.

B: JSON.parse throws for invalid JSON. A guarded read catches the problem and continues with an empty in-memory list. A later successful write may replace the invalid value. Calling localStorage.clear would remove unrelated keys, so use removeItem with the exact lesson key.

C: inspect the capstone walkthrough, then the runnable reference. Compare one checkpoint at a time. The reference's pure functions live in core.js; storage boundaries in storage.js; DOM and event wiring in app.js. If you copy it, you still need to explain and test the action yourself.

A pressed Save button indicates a browser shortlist choice. It does not reserve capacity. The stable label works with aria-pressed, while separate status text tells the visitor whether persistence succeeded or only in-memory state changed. If the focused card disappears from saved-only results, focus moves to the saved-only control rather than being lost.

Return to the exercise