Skip to Content
Learn
Iterators
Choose the Right Iterator

There are many iteration methods you can choose. In addition to learning the correct syntax for the use of iteration methods, it is also important to learn how to choose the correct method for different scenarios. The exercises below will give you the opportunity to do just that!

You’ll see errors pop up in the terminal as you work through this exercise, but by the end the errors will be gone!

Instructions

1.

Replace the word method in the first method call with a method that will do something to each of the values in the array and return undefined.

2.

In the second method call, replace the word method with a method that will return a new array with only those elements longer than 7 characters.

3.

In the third method call, replace the word method with a method that take an array that contains multiple values and returns a single value.

4.

In the fourth method call, replace the word method with a method that will return a new array of numbers returned from the function.

5.

In the fifth method call, replace the word method with a method that will return a boolean value.

Folder Icon

Take this course for free

Already have an account?