What can we do with ES6 Generator that we cannot with for loop?
问题 I went trough ES6 features and Generators caught my eye. One thing that sprang to mind is chaining Promise objects, that I could not do with loops. What other mechanics we will be able to do, that we could not before? I do understand this is broad question, still I can\'t think of anything but Promises at the moment. 回答1: By using yield , generators can be suspended at any point in the control flow of your function, saving your current state of execution (scope & stack). Without generators,