From the course: JavaScript: Patterns

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Iterator pattern

Iterator pattern - JavaScript Tutorial

From the course: JavaScript: Patterns

Start my 1-month free trial

Iterator pattern

- [Instructor] The iterator pattern is another method of iterating through list of items, whereas the chain of responsibility will use more of a handler type and go through a chain. The iterator is best used with a for loop and is perfect when you want to iterate through rays of objects. Let me demonstrate. So we'll get back to code by using the base. So the first thing I'm going to do is drag and drop this particular folder into Visual Studio Code or on the Windows, you can right click to the folder and then open in Visual Studio Code. And the first thing I'm going to do is remove all the code that we have here. I'll refer back to the code in the exercise files if you need to. So let me just delete that and then what we're going to do is also open the react application. So let's go back to our desktop and then open the exercise files and I believe the react application is right here on 04_03. Let's copy that into a brand…

Contents