Uitdaging: Print Nummers van 5 tot 9 Af
Taak
Laten we een while-lus implementeren die nummers van 5 tot 9 naar de console uitvoert.
123456let a = 5; ___ (a ___ ___) { console.log(___); ___++; };
De uitvoer moet zijn:
5
6
7
8
9
- Stel de voorwaarde in op a
<= 9
ofa < 10
. - Voeg de variabele
a
toe binnen deconsole.log()
functie. - Verhoog de waarde van
a
binnen de lus.
123456let a = 5; while (a <= 9) { console.log(a); a++; }
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 5. Hoofdstuk 3
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Suggested prompts:
Can you explain how the while loop works in this example?
What would happen if we changed the starting value of 'a'?
Can you show how to do the same with a for loop?
Awesome!
Completion rate improved to 2.33
Uitdaging: Print Nummers van 5 tot 9 Af
Veeg om het menu te tonen
Taak
Laten we een while-lus implementeren die nummers van 5 tot 9 naar de console uitvoert.
123456let a = 5; ___ (a ___ ___) { console.log(___); ___++; };
De uitvoer moet zijn:
5
6
7
8
9
- Stel de voorwaarde in op a
<= 9
ofa < 10
. - Voeg de variabele
a
toe binnen deconsole.log()
functie. - Verhoog de waarde van
a
binnen de lus.
123456let a = 5; while (a <= 9) { console.log(a); a++; }
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 5. Hoofdstuk 3