0

What is the difference between an iterator and a generator, and when would you use one over The other?

22nd Apr 2019, 1:35 PM
Logomonic Learning
Logomonic Learning - avatar
2 Respuestas
0
In essence, Ive learnt that the difference between n iterator and a generator, is: that the generator is simply a function with * affixed. it uses the yield keyword to iterate over its members. it can also call other generators with * you can control it manually with the .next() method. the iterator is created with [Symbol.iterator]() it can also be iterated over with the next().value methods iterators and generators are useful in asynchronous programming
28th Apr 2019, 12:43 AM
Logomonic Learning
Logomonic Learning - avatar