Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// assuming http://www.html5rocks.com/en/tutorials/es6/promises/
var arr = [1, 2, 3, 4, 5];
var promises = arr.map(x => $.getJSON('/foo/bar?baz=' + x));
Promise.all(promises)
.then((result1, result2, result3, result4, result5) => {
//merge results
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.