Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
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 | |
|---|---|---|
| 1fruits.forEach(function(fruit) { ... }) | APrints every number in nums, one at a time | |
| 2nums.forEach(function(n) { console.log(n); }) | BCalls the function once for each element in fruits | |
| 3Runs a function once for every element in an array | CWrong - missing the 'function' keyword before the parameter | |
| 4Holds the current element's value during each call | Darray.forEach(function(item) { ... }) | |
| 5fruits.ForEach(function(fruit) { ... }) | EWrong - 'forEach' must start with a lowercase f | |
| 6fruits.forEach(fruit) { ... } | Ffruit |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
forEach() — Calls a given function once for every element in an array.fruits.forEach(function(fruit) {fruits.forEach(function(fruit) {colors.forEach(function(color) {colors.forEach(function(color) {nums.forEach(function(n) {