We store an array of animal names in the
animals
variable (e.g. let animals = ["dog", "cat", "hamster", "rabbit"];
). Which of the following statements will display exactly two names from the array?
for (let n in animals) console.log(n);
for (let i =3 ; i < animals.length; i++) console.log(animals[i]);
for (let i = 0; i < animals.length; i+=2) console.log(animals[i]);
for (let n of animals) console.log(n);
More Questions: JavaScript Essentials 1 – JSE1: Module 4 Test
Please login or Register to submit your answer