Great explanation and to the point. I watched some other ones that were almost a half hour long and learned nothing. Overly complex and left me confused unlike your video. Thank you, please continue your tutorials!
I can do this with while loop directly(without additional function call overhead), So what is the advantage here? Where does we use these pattern? Is this just for good readable code.
it becomes handy for more complex traversels. You could for example implement a tree traversel with this and extract out the formula for checking and finding a nodes children.
hi, i've learned a lot about design patterns(theory mainly). Most of the time they are explained for languages that implement interfaces (java, php, typescript etc...) Do you know a way to simulate interfaces in javascript?
🤖 GitHub: github.com/pkellz/devsage/blob/master/DesignPatterns/IteratorPattern.js
📕 "Design Patterns Explained Simply" Ebook - payhip.com/b/MLtJ
💙 Twitter: twitter.com/realDevSage
📙 Ebooks: payhip.com/devsage
💥 Discord: discord.gg/BP8wPv6raA
Great explanation and to the point. I watched some other ones that were almost a half hour long and learned nothing. Overly complex and left me confused unlike your video. Thank you, please continue your tutorials!
Glad I could help!
Very clear explanation and easy to understand examples. I love you vids man. Keep em coming
Preciate that 👍
Really good material on this channel that has already helped thousands, and thousands to come! keep up the good work its much appreciated to find gems
This comment made me smile. Appreciate that 💯
Thank you again for all the great work 🙏😀 I see that switch to the dark theme btw, nice!
I will "Iterate" throw this channel to learn more stuff!
I can do this with while loop directly(without additional function call overhead), So what is the advantage here? Where does we use these pattern? Is this just for good readable code.
Very good question.... Waiting for answer from Devsage
I think is because you can set up you own rules to move over the array
it becomes handy for more complex traversels. You could for example implement a tree traversel with this and extract out the formula for checking and finding a nodes children.
What's the point in using this over a standard for-loop ?
Your videos have been super helpful... Thank you!!!!
Glad you like them!
great tutorial. I am noticing that you are using diffent websites for each tutorial, can I ask why?
Thanks. Sometimes a website lags really bad while I'm recording. When that happens, I try to use a different site
He is not only changing websites, he also is switching os, windows to ubuntu and again windows 😂
Thanks for the video. man! Simple and well explained!
Great series. Vanillajs tutorials are very few
Glad you like them!
Thank you for this amazing series
thanks for the explanation.
I think that for better readability you should not shadow global variables (items). It can confuse newbies.
thank sir you're amazing 😃
FYI, this is a behavioral pattern
why didn't we just define the methods hasNext and next inside the function Iterator itself? why did we use prototype here?
Thank you
hi,
i've learned a lot about design patterns(theory mainly). Most of the time they are explained for languages that implement interfaces (java, php, typescript etc...)
Do you know a way to simulate interfaces in javascript?
Use classes or learn typescript
Definitely use typescript
From where did . Prototype come from? 🤔🤔 Hasnext and next ⁉️
An iterator in js seems kinda pointless to me, but maybe it makes sense to use them for very complex programs.
I know Some java frameworks follows this pattern.
Scanner scanner = new Scanner(items);
while(scanner.hasNext()) {
System.out.println(scanner.next());
}