-
Notifications
You must be signed in to change notification settings - Fork 0
eigen versie van loops.js toegevoegd #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,9 @@ | |
| // Hoera! | ||
| // ========================================== | ||
|
|
||
|
|
||
| for (let index = 0; index < 3; index ++) { | ||
| console.log("Hoera"); | ||
| } | ||
|
|
||
| // ========================================== | ||
| // Opdracht 2. Maak een for-loop die 4 keer het woord "loop..." logt, en bij de vijfde loop het woord "klaar!" | ||
|
|
@@ -18,7 +20,10 @@ | |
| // klaar! | ||
| // ========================================== | ||
|
|
||
|
|
||
| for (let index = 0; index < 4; index++) { | ||
| console.log("Loop..."); | ||
| if (index===3) {console.log("Klaar!");} | ||
| } | ||
|
|
||
| // ========================================== | ||
| // Opdracht 3. Maak een for-loop die van 0 tot 15 loopt. Voor ieder getal wordt in de console gelogd of het getal even of oneven is. | ||
|
|
@@ -33,6 +38,13 @@ | |
| // Tip: een getal is oneven als je het door 2 deelt en er blijft nog iets over. Een getal is even als je het deelt door 2 en er blijft niets over.. | ||
| // ========================================== | ||
|
|
||
| for (let plekkie = 0; plekkie < 16; plekkie++) { | ||
| console.log(plekkie) | ||
| if (plekkie%2 == 0) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Volgens mij is het conventie om een spatie tussen plekkie, % en 2 te zetten. |
||
| console.log("is even") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Vergeet plekkie niet mee te loggen: console.log(plekkie + " is even") |
||
| else | ||
| console.log("is oneven") | ||
| } | ||
|
|
||
|
|
||
| // ========================================== | ||
|
|
@@ -49,4 +61,3 @@ | |
| // >> 7 | ||
| // >> 9 | ||
| // ========================================== | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ik zie de uitwerking van de bonusopdracht niet. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regel 42 is overbodig.