I'm taking about making you own iterable using [Symbol.iterator] - I know how it technically works, but I cannot think of a genuine usecase. What can you do with this?
CodePudding user response:
The most common use case is to create a custom iterator for a custom data structure. For example, if you have a tree data structure, you can create an iterator that traverses the tree in a specific order (e.g. depth-first).