Skip to content

Latest commit

 

History

History
32 lines (25 loc) · 1.29 KB

2018-04-22-js-generator-functions.md

File metadata and controls

32 lines (25 loc) · 1.29 KB
layout title description category startDate tags comments learnings links
post
Javascript generator functions
Using generator functions in conjunction with promises
diary
2018-04-02
javascript
generator functions
api
false
How to use generator functions to write async code in a synchronous manner
How to combine generator functions and promises
How to iterate generator functions
How to use a recursive function to iterate over a generator function passing promises for each yield

What I've done today

Generators are functions which can be exited and later re-entered. Their context (variable bindings) will be saved across re-entrances.

Generators in JavaScript -- especially when combined with Promises -- are a very powerful tool for asynchronous programming

I continued with my JS course; the chapter is about generator functions. I did the introduction but do not really see how this would work with a "real world example".

Luckily the DIY programming lesson is coming up which hopefully clearifies that.

What I'm planning to do next

I'll do the hands on and use generator functions and promises to do API calls.