1.9 KiB
1.9 KiB
Testing the Examples
Build and serve
make
python3 -m http.server 9994 --directory examples
Open http://localhost:9994/basics/index.html for the full index, or test each example directly below.
basics/hello.html
http://localhost:9994/basics/hello.html
- Page loads → browser alert says Hei maailma!
basics/factorial.html
http://localhost:9994/basics/factorial.html
- Page loads → prompt appears
- Enter
5→ alert shows 120 - Enter
0→ alert shows 1
basics/fibonacci.html
http://localhost:9994/basics/fibonacci.html
- Page loads → prompt appears
- Enter
10→ alert shows 55 - Enter
1→ alert shows 1
data-structures/lista.html
http://localhost:9994/data-structures/lista.html
- Right panel shows the list
[3, 1, 4, 1, 5] - Size: 5, first element: 3
- Ascending sort: 1 1 3 4 5
- Descending sort: 5 4 3 1 1
data-structures/vektori.html
http://localhost:9994/data-structures/vektori.html
- Dimension: 2
- Sum: 7
- Length (3-4-5 triangle): 5
strings/merkkijono.html
http://localhost:9994/strings/merkkijono.html
- Merkkijono: Hei, Tampio!
- Pituus: 12
- Yhdistetty: Hei, Tampio! Vuosi 2026.
- Siistitty: 'välilyönnit poistuvat'
- Hedelmät: omena banaani kiivi
async/nappi.html
http://localhost:9994/async/nappi.html
- Two buttons visible: +1 and +10
- Click +1 → one
▪dot appears - Click +10 → ten
▪dots appear - Dots accumulate across clicks
program/kasvutaulukko.html
http://localhost:9994/program/kasvutaulukko.html
- Kertoma (n!) section shows:
1 1 2 6 24 120 720 - Fibonacci-kani (fib(n)) section shows:
1 1 2 3 5 8 13
Checking for errors
Open browser DevTools (F12 → Console) on any page and verify no red errors appear. The only expected output is from the examples themselves.