Skip to content

Instantly share code, notes, and snippets.

@indatawetrust
Created July 30, 2016 10:34
Show Gist options
  • Save indatawetrust/ff20f6fc54449e6fd908cad226ff9f73 to your computer and use it in GitHub Desktop.
Save indatawetrust/ff20f6fc54449e6fd908cad226ff9f73 to your computer and use it in GitHub Desktop.
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