Skip to content

Instantly share code, notes, and snippets.

@aaronpowell
Created December 2, 2015 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronpowell/164f6bed72eee8c62cdc to your computer and use it in GitHub Desktop.
Save aaronpowell/164f6bed72eee8c62cdc to your computer and use it in GitHub Desktop.
// 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