Skip to content

Competence grid for part 1

Use this grid to judge whether you are ready for part 2. Read each row and solve the check task next to it without looking anything up. If it feels easy, you have reached the goal. If not, the link in the last column takes you to the right place.

I can …Check taskLook it up
split code into modules with export and importExplain why node main.mjs stops before the first line of output when an export is missing in catalog.mjs.Modules and packages
set up a project with package.json and run scriptsAdd a script to a project and run it with npm run.Modules and packages
read version ranges and explain what the lock file is forExplain the difference between 5.0.5 and ^5.0.5 and say whether package-lock.json belongs in the repo.Modules and packages
explain why two variables can change the same objectExplain the bug with the tents using the figure with the two variables.Values and references
copy objects shallowly and deeplySay when { ...item } is enough and when you need structuredClone.Values and references
change data without changing the originalWrite a function that marks a thing as on loan in a new list.Values and references
analyze lists with map, filter, find and someList the names of the things that are in and cost more than CHF 40 in deposit.Functions and arrays
count with reduce and sort lists without side effectsCount the things on loan per category and sort their names with localeCompare.Functions and arrays
predict the order of code with promises and timersPredict the output of the example on the event loop and explain it.Asynchronous JavaScript
load data with fetch and report errors clearlyExplain why fetch doesn't reject for status 404, and show how you notice the error anyway.Asynchronous JavaScript
abort a request after a time limitLoad the catalog with a time limit of one second from the server answering with ?delay=3000.Asynchronous JavaScript
explain how a proxy notices changes (deep dive)Explain what track and trigger do in the small reactive system.Proxies and getters

For part 2 you mainly need modules, arrays and fetch. The last row belongs to the deep dive and is optional.

What Martina Hostettler's assignments in this part added up to is in the course repo in the folder case/01-javascript/en. There is no interface yet, only the helper functions for the catalog, the overview for the counter and the small server. The tests in the folder tests check the wishes from all four chapters.

Terminal window
npm install
npm test

If you didn't finish everything in part 1, start part 2 from this state.

Text and figures are licensed under CC BY-SA 4.0, the code under the MIT License and the course data under CC0 1.0. The figures use the font Kalam under the SIL Open Font License 1.1. The sources are on GitHub.