Created
June 10, 2018 09:32
-
-
Save saylestyler/41c9ce3cc7f2da383695fe20cfc8c2b6 to your computer and use it in GitHub Desktop.
This file contains 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
let p = (v) => { | |
return new Promise((resolve, reject) => { | |
setTimeout(resolve, 1000) | |
}).then(() => v) | |
} | |
[1, 2, 3, 4, 5].reduce((seq, curr) => { | |
return seq.then(() => p(curr)).then(console.log) | |
}, Promise.resolve()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment