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 first number is the index of the _______ point. | continents.splice(3, 4, "Australia"); | insertion | insertion |
In the following code, the second number is the number of _______ to remove. | continents.splice(3, 4, "Australia"); | elements | elements |
Code a statement that removes the second element from an array named pets. Don't insert any additional elements. | pets.splice(1, 1); | pets\.splice\(1,1\); | |
The array is nums. Code a statement that inserts the integer 89 at index 5 without removing any elements. | nums.splice(5, 0, 89); | nums\.splice\(5,0,89\); | |
Remove the first two elements and insert "Kia". Make up the array name. | cars.splice(0, 2, "Kia"); | [a-z_$][a-zA-Z0-9_$]*\.splice\(0,2,•Kia•\); | |
Insert an integer after the second element. Don't remove any elements. Make up the array name and the integer. | nums.splice(2, 0, 24); | [a-z_$][a-zA-Z0-9_$]*\.splice\(2,0,(0|-?[1-9][\d]*)\); | |
Alter the following array, named nums, so it becomes [-1,0,1,3,4]. | [-1,0,1,2] | nums.splice(3, 1, 3, 4); | nums\.splice\(3,1,3,4\); |
Alter the following array, named players so it becomes ["Ji", "Toledo"]. | ["Fox","Abe","Ko","Rock","Klaus"] | players.splice(0, 5, "Ji", "Toledo"); | players\.splice\(0,5,•Ji•,•Toledo•\); |
|
|||
|