3 ms·
Wait that doesn't make sense, was generators in the language before Promises, actually isn't await based on generators? How is that a new paradigm?
by akritrime 7y ago
Wait that doesn't make sense, was generators in the language before Promises, actually isn't await based on generators? How is that a new paradigm?
- tchaffee 7y agoPromises and generators were ES6, so around the same time. Although people were using promises long before it became an official feature in ES6. I remember using promises as far back as 2012 or earlier - jquery had them. ES6 was 2015. Await and async came after in ES7 and can be considered to use yield[1]. So there you go - that's a perfect example of the power of generators. Promises used to be more difficult until they were simplified using generators. [1] https://stackoverflow.com/questions/36196608/difference-between-async-await-and-es6-yield-with-generators https://stackoverflow.com/questions/36196608/difference-betw...