Modul 288: Programmiertechniken im
Webfrontend einsetzen
Woche 5
Colin Schmid
colin.schmid@gbchur.ch
Mediamatiker/in EFZ
🔭 Wochenrückblick
🎯 Lernziele
🗓️ Termine
🛸 Begleitetes Selbststudium: Learn Javascript
🏹 Input: Arrow Functions
📔 Lernjournal
🎙️ Schlussrunde
let x = 10;
function multiply(y) {
let x = 2;
return x * y;
}
console.log(multiply(5));What will this program print?
A) 10
B) 20
C) 50
D) undefined
Follow-up:
Why doesn’t the function use the x = 10 defined outside?
What would happen if we removed let x = 2; from inside the function?
🟠
🟠
🟢
🟠
🟠
🟢
🟢
🔴
🔴
🟠
🔴
🔴
🟢
🟠
🟠
🔴
🟠
An arrow function expression is a compact alternative to a traditional function expression, with some semantic differences and deliberate limitations in usage:
this, arguments, or super, and should not be used as methods.
Arrow functions cannot be used as constructors. Calling them with new throws a TypeError. They also don't have access to the new.target keyword.
Arrow functions cannot use yield within their body and cannot be created as generator functions.
Jeder Lernende hat 3 - 5 min Gesprächszeit mit mir über:
🧮 Schlüssel:
| Kriteria | Punkte |
|---|---|
| Bereit, reflektiert, engagiert | 1 |
| Passiv oder unvorbereitet | 0.5 |
| Unentschuldigte Absenz | 0 |
Jeder Lernende schreibt jede Woche nach der Lektion eine kurze Reflektion. Aufwand: 5 – 10 min, könnte sein:
🧮 Schlüssel:
| Kriteria | Punkte |
|---|---|
| Durchdacht, spezifisch, persönlich | 1 |
| Generell, gehetzt oder unklar | 0.5 |
| Fehlend | 0 |
Was haben wir heute gelernt?
Was nehmen wir mit?