Web Foundations — Student Examples
Every example from class, in the order we learn it. Open a file, read the comments, change something, and see what happens.
0Before you start
Keep the VS Code shortcuts page open in another tab. It shows how to open a folder, use the terminal and edit faster.
Every lesson below opens in a new tab. When you finish, close that tab and you are back on this page.
1JavaScript
How to run a lesson
- Make a folder on your laptop (for example
js-practice) and open it in VS Code.
- Open a lesson below and press ⬇ Download this file (or copy the code into a new file with the same name). Save it in your folder.
- Open the terminal (Ctrl + `).
- Run a file:
node "01 - console.js" (the quotes are needed because the name has spaces).
- Read the comments in the file — the
// Output: lines tell you what you should see.
Each lesson ends with a Quick summary and Practice tasks. Do the tasks before moving to the next file.
1bJavaScript practice — 10 must-do programs
After lesson 12, write these 10 programs yourself
- Read how to practise first.
- Each file has a story, the rules, the data, and STEPs. Write your code under each STEP.
- Download the program into your folder, then run it:
node "01 - fee-receipt.js". Compare with the expected output at the bottom.
- When your output matches, show it to your trainer. Solutions are shared after class.
Each program uses everything before it, plus one new idea. Programs 09 and 10 use every concept from lessons 01–12.
2CSS
How to use a lesson
- Each lesson is a folder. Each example inside it is a pair:
01-name.html + 01-name.css.
- Open the
.html file in the browser (double-click it).
- Open the
.css file with the same name in VS Code. Read the comments and the Try it: lines.
- Change a value, save (Ctrl + S), and refresh the browser (F5).
Pictures used by the examples are in CSS/assets. Do not move or rename them, or the pages will lose their images.
3DOM — JavaScript in the page
How to use a lesson
- Each example is three files with the same name:
.html + .css + .js. The .js file is the lesson — read it first.
- Open the
.html in the browser, then press F12 and click Console to see the messages it prints.
- Pages with see in the name are teaching animations: press Step ▶ (or →) to watch the browser work one step at a time.
- Edit the
.js, save, refresh. You never need to open the assets folder — it only runs the animations.
- 01what is the DOM
- 02selecting elements
- 03changing content
- 04styles & classes
- 05events
- 06event flow
- 07create & remove
- 08traversal
- 09forms
- 10CSS animation with JS
- 11Web Animations API
- 12timers & frames
- 13scroll & observers
- 14storage
- 15components
- 16projects