typescript · level 2 check
a weekend weather planner.
Time to build something useful: a weekend planner. It asks which town you are in, fetches that town's forecast from Gwecode's practice server, and suggests a plan for every day. Sun means a picnic, cloud a bike ride, and rain board games at home.
Each day in the forecast has a name, a sky, a high temperature and sometimes a wind speed. Servers are not always kind, so trust nothing. `readDay` validates every day and gives `null` for broken ones, which the planner skips and counts. Wind of 30 or more earns a warning.
The practice server may not know the town, or may send something that is not a list. Throw a clear error for both, and let one `catch` explain it. If nobody types a town, say so before asking the server. Fill in each `____`, then run it and type a town.
Fill in every ____ then run the checks.
- 1 It plans every day in the forecastuses: fetch
- 2 It tidies the town before asking the serveruses: text tricks
- 3 It skips days with broken datauses: validating
- 4 It explains when a town has no forecastuses: errors
- 5 It refuses a reply that is not a listuses: unknown
- 6 It asks for a town when none is givenuses: null and ??
Take as long as you like and try as many times as you want.
typescript · level 2 · medium
level up.
You passed every check. Your face is now B).
- 28 lessons in this level
- 6 of 6 checks passed
This pass isn’t saved. A free account keeps your new face.