39 Answers to Review Questions. “Digital Media Primer” Yue-Ling Wong
B. reptiles.push();
C. reptiles.pop(“crocodile”);
D. reptiles.pop();
E. reptiles.unshift(“crocodile”);
F. reptiles.unshift();
G. reptiles.shift(“crocodile”);
H. reptiles.shift();
8. Suppose an array reptiles is [“snake”, “turtle”, “lizard”]. To add “crocodile” to the
beginning of the array, use the statement ___.
A. reptiles.push(“crocodile”);
9. Suppose an array reptiles is [“snake”, “turtle”, “lizard”]. To add “crocodile” between the
second and third items (i.e., between “turtle” and “lizard”), use the statement:
reptiles.splice(_______,_______,_______);
10. Suppose an array reptiles is [“snake”, “turtle”, “lizard”, “crocodile”]. To remove the last
item from the array, use the statement ___.
A. reptiles.push(“crocodile”);
B. reptiles.push();
C. reptiles.pop(“crocodile”);
D. reptiles.pop();
E. reptiles.unshift(“crocodile”);
F. reptiles.unshift();
G. reptiles.shift(“crocodile”);
H. reptiles.shift();
11. Suppose an array reptiles is [“crocodile”, “snake”, “turtle”, “lizard”]. To remove the first
item from the array, use the statement ___.
A. reptiles.push(“crocodile”);
B. reptiles.push();