re: Use-Cases For JavaScript Generators VIEW POST

TOP OF THREAD FULL DISCUSSION
re: You left out combining the generators API with Symbol.iterator to create an object which can be used with the browser's native for/of syntax. devel...
 

Didn’t leave out the Symbol.iterator ... was looking for “practical” use-cases. Can you show, in code, a use case beyond the Hello World examples?

For the rSchedule ... THAT is what I was looking for. Can’t wait to dig through their code!

 

I'll let rSchedule be my practical example.

Though I'm getting the impression that we might have different conceptions of the word "practical". From my perspective, a for loop is one of the most basic javascript keywords. Used in pretty much every app ever. The practicality of being able to hook into that keyword (and related keywords continue and break) with a custom object seems self evident? Or are you more simply wondering why someone wouldn't just extend Array (or expose the data as an array via a property)?

code of conduct - report abuse