JavaScript Fundamentals -- Looping in JavaScript

Looping Exercise 1


For this exercise, you need to provide a solution for the following:

// 1. Use a loop to add 2 to the num variable 5 times
let num = 0;

// 2. Loop over the pets array and log each of the names to the console
const pets = ['Duke', 'Max', 'Apollo', 'Cincy']

// 3. Loop over the pets array and only print out every other one

You can fork this StackBlitz project for the assignment.