JavaScript From Zero · 30 min · 230 XP

Checkpoint: packing list

Build an interactive packing list from state, render it safely, and handle additions and removals through events.

This checkpoint gives you the page but no JavaScript. Plan the state and the render function first; then each event handler only has to change the state and call render.

This brings the DOM lessons together. Keep the list in a JavaScript array, and treat the page as a picture of that array, never as the place the data lives. The submit handler checks the input and adds to the array. One click listener on the list removes from it. And one render function rebuilds the whole list and the count from the array, every time it runs.

Build it in that order: render first, called once at startup so you can see it working, then adding, then removing.

Loading your workspace…