Javascript
JavaScript Fundamentals -- Looping in JavaScript

Looping Exercise 1

Mute
Current Time 0:00
/
Duration Time 0:00
Loaded: 0%
Progress: 0%
Stream TypeLIVE
Remaining Time -0:00
 
PRO

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.

 

I finished! On to the next chapter