DEV Community

Discussion on: Understanding Generators in Javascript - Javascript weekly

 
akashkava profile image
Akash Kava

This is only possible when you have your conditions when you want to iterate it, imagine series of function passing each other generators, and final evaluator does not have access to all conditions.

Thread Thread
 
karataev profile image
Eugene Karataev

Conditions functions should exist somewhere. I think it's always possible to refactor the code and have access to these functions (for example, by moving the conditions functions higher in lexical scope).