Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This for...of Loops worksheet is part of the JavaScript Coding without HTML and CSS journey. Print it as a booklet?
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1for (let fruit of fruits) { ... } | AGives direct access to each value in nums, not the index | |
| 2for (let n of nums) { ... } | Blet fruit | |
| 3Loops directly over each value in an array | CWrong - use 'of', not 'in', to loop through values | |
| 4Holds the current value during each pass of the loop | Dfor...of | |
| 5for (let n in nums) { ... } | EWrong - 'for' must be lowercase | |
| 6For (let n of nums) { ... } | FLoops through each value in the fruits array |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
for...of — Loops directly over each value in an array, without needing an index.for (let fruit of fruits) {for (let fruit of fruits) {for (let color of colors) {for (let item of items) {for (let num of nums) {