Imagine you had a grocery list and you wanted to know what each item on the list was. You’d have to scan through each row and check for the item. This common task is similar to what we have to do when we want to iterate over, or loop through, an array. One tool at our disposal is the
for loop. However, we also have access to built-in array methods which make looping easier.
In this lesson, you will learn the syntax for these methods, their return values, how to use the documentation to understand them, and how to choose the right iterator method for a given task.
Inspect the code in main.js. Notice the different methods being called on the arrays:
Run the code to see the output!