1
2
3
4
5
6
7
8
9
10
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to CodePen.
0,1,2,3,4,5,6,7,8,9
0
0
0
0
What is the keyword that causes an exit from a loop before it's finished iterating? | break | break | |
What is the keyword that makes a loop skip the next array element? | continue | continue | |
The following statement assigns the number of elements in the array to the variable. Fill in the blank. | let num = planets.________; | length | length |
After the following code executes, how many elements have been changed to true? Answer with a numeral, like 1. | const x = [false, false, false, false, false, false, false]; for (let i = 0; i < x.length; i++) { x[i] = true; if (i === 3) { break; } } |
4 | 4 |
Fill in the blank to limit the number of iterations to the number of array elements. The name of the array is guestlist. | for (let i = 0; ________; i++) { | i < guestlist.length | i9Stumpguestlist\.length |
What are the elements in the array after the following code executes? Separate the elements by a comma and space. | const capitals = ["Stockholm", "Monrovia", "Barcelona", "Rio"]; for (let i = 0; i < capitals.length; i++) { if (i > 2) { continue; } capitals[i] = i; } |
0, 1, 2, "Rio" | \[?0,1,2,•Rio•\]? |
Assign the number of elements in an array to a variable. Make up the name of the variable and the name of the array. | let numZips = zipCodes.length; | let[a-z_$][a-zA-Z0-9_$]*=[a-z_$][a-zA-Z0-9_$]*\.length; | |
Fill in the blank so 0 is displayed in the alert; | let counter; for (let i = 0; i < capitals.length; i++) { counter = i; ______ } alert(counter); |
break; | break; |
|
|||
|