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
In the following code, the 9 is the element's ____. (one word) | someNumbers[9]; | index | index |
When JavaScript does its automatic numbering, the starting index is __. | 0 | 0 | |
Create a new array, nums, comprising three numbers from 3 to 5. Use the syntax you learned in the book. | const nums = [3, 4, 5]; | constnums=\[3,4,5\]; | |
Specifying an index on the array below, code an alert that displays "Gail". | const names = ["Alf", "Bo", "Gail"]; | alert(names[2]); | alert\(names\[2\]\); |
Create an array with two elements, both strings. The array hasn't been declared beforehand. Make up the array name and the strings. | const airlines = ["Italia", "Emirates"]; | const[a-zA-Z0-9_$]*=\[•.*•,•.*•\]; | |
Assign to a variable the first element of an array. The variable hasn't been declared beforehand. Make up the variable name and the array name. | let mealExpense = expenses[0]; | let[a-z_$][a-zA-Z0-9_$]*=[a-z_$][a-zA-Z0-9_$]*\[0\]; | |
Create an array with three elements: a number, a string, and a variable. Make up everything. | const list = [1, "one", one]; | const[a-z_$][a-zA-Z0-9_$]*=\[[-]?(?:[.]\d+|\d+(?:[.]\d*)?),•.*•,[a-z_$][a-zA-Z0-9_$]*\]; | |
Create an array with two string elements. Then assign the last element in the array to a variable. The variable hasn't been declared beforehand. Make everything up. | const socialNets = ["Instagram", "TikTok"]; let net2 = socialNets[1]; |
const([a-z_$][a-zA-Z0-9_$]*)=\[•.*•,•.*•\];[\r\n]let[a-z_$][a-zA-Z0-9_$]*=\1\[1\]; | |
|
|||
|