Skip to content

Commit 3530964

Browse files
committed
studio
1 parent 5197181 commit 3530964

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arrays/exercises/part-three-arrays.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ let cargoHold = [1138, 'space suits', 'parrot', 'instruction manual', 'meal pack
33
//Use splice to make the following changes to the cargoHold array. Be sure to print the array after each step to confirm your updates.
44

55
//1) Insert the string 'keys' at index 3 without replacing any other entries.
6-
6+
cargoHold.splice(3,0,'keys');
7+
console.log(cargoHold)
78
//2) Remove ‘instruction manual’ from the array. (Hint: indexOf is helpful to avoid manually counting an index).
89

910
//3) Replace the elements at indexes 2 - 4 with the items ‘cat’, ‘fob’, and ‘string cheese’.
11+
cargoHold.splice(2,3,'cat','fob','string cheese');
12+
console.log(cargoHold);

0 commit comments

Comments
 (0)