Created
July 30, 2016 10:34
-
-
Save indatawetrust/ff20f6fc54449e6fd908cad226ff9f73 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const list = ["a","b","c","d","e"] | |
function * up() { | |
for(let i of list) { | |
yield new Promise((resolve,reject) => { | |
resolve(i) | |
}) | |
} | |
} | |
const b = up() | |
for(let i of b) { | |
i.then(char => console.log(char.toUpperCase())) | |
} | |
/* | |
log : | |
A | |
B | |
C | |
D | |
E | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment