3 ms·
These things are all just tools in the programmer's tool box. Which one you use will come down to the one you think is most suitable at the time based on your
by scrapheap 5y ago
These things are all just tools in the programmer's tool box. Which one you use will come down to the one you think is most suitable at the time based on your knowledge and experience.
Generators are very useful in more complex scenarios, but when used in simpler environments they'll just add confusion - in fact the article is a good example of adding confusion with a Generator.
Personally, when dealing with arrays I favour using .map, .reduce, .filter and .forEach.