Goal: In the Looping lesson, we learned:
As we can see, looping is an incredibly important programming concept. Now it's time to practice. We'll begin with several looping exercises in the console and then move on to creating and updating small projects.
Array.prototype.forEach()to loop through an array called "kittens", what should we call the parameter in the
console.log()a greeting to each.
Refactor your Mad Libs page we created in this exercise to use a loop.
In the Introduction to jQuery lesson we created a web page that triggered alerts containing information about a particular HTML tag whenever a user clicked on an HTML element. Try to refactor this page's multiple, similar event listeners using a loop.
Note: When choosing a name for the variables in your loop, it's good practice to use a plural for the array and the singular form of that word for the loop.
The array is named
languages and the parameter is the singular
Lesson 14 of 38
Last updated March 23, 2021