CHAPTER 1 · 5 lessons · 5 exercises
Build a to-do list
Type, add, clear away — a whole app in five steps.
You now have both halves: thinking in JavaScript, and building a page with HTML and CSS. This chapter puts them together. You are building a to-do list you can type into, add to, and clear away when things are done.
It moves differently from the other courses. Each lesson is one step of the build, and each one starts from the finished state of the last. So getting stuck is fine — the next step begins from "that far already done", and you will never be left behind.
Here are the five steps.
- Put the pieces on the page — a text box, a button, an empty list. Nothing moves yet
- Add what you typed — the page moves for the first time. Make it, fill it, attach it
- Let Enter add it too — wrap it in a
formand stop the reload - Clear away what is finished — a button per row that removes only that row
- Tidy it up and take it home — turn rows into cards and save it to your device
Marking works differently too. Your code gets actually run, buttons get actually pressed, and only then does anything look at the page. "Type into the box, press the button, and the list grows by one" — that is what has to happen for it to count. So your code does not have to match the answer, it just has to work.
In the last step you can save what you built. As one bundled file it runs the moment you tap it; as a three-file zip you can carry on in an editor on a computer. This is your first step out of the app.
Lessons in this chapter
Place it
- 01Put the pieces on the pageA text box, a button, an empty list. Nothing moves yet, but everything you will touch is there.Go to the exercises
Make it move
- 02Add what you typedPress the button and your text lines up below. This is the step where the page starts moving.Go to the exercises
- 03Let Enter add it tooPress Enter in the box and it adds. This is where you learn to stop a submit.Go to the exercises
- 04Clear away what is finishedGive every row its own Done button, and make it remove only that row.Go to the exercises
Tidy it up and take it home
- 05Tidy it up and take it homeTurn each row into a card, then save the finished app onto your own device.Go to the exercises