Thursday , September 19 2024

We can use the forEach method to pass through the elements of an array. Which of the following code snippets will display all consecutive elements of the animals array in the console?

Questions BankCategory: JavaScript Essentials 1We can use the forEach method to pass through the elements of an array. Which of the following code snippets will display all consecutive elements of the animals array in the console?
We can use the forEach method to pass through the elements of an array. Which of the following code snippets will display all consecutive elements of the animals array in the console?

  • animals.forEach(a => {
        console.log(a);
    })
  • forEach(animals, a => {
        console.log(a);
    })
  • animals.forEach(console.log(animal));
  • animals.forEach(a => a);

More Questions: JavaScript Essentials 1 – JSE1: Module 5 Test