Skip to content

Instantly share code, notes, and snippets.

@timwco
Created August 15, 2016 17:23
Show Gist options
  • Save timwco/ab25f9f18bd708bfdd71d586a5d799f2 to your computer and use it in GitHub Desktop.
Save timwco/ab25f9f18bd708bfdd71d586a5d799f2 to your computer and use it in GitHub Desktop.
Resolve A List of Promises
'use strict';
let promise1 = $.getJSON('http://www.omdbapi.com/?i=tt1285016');
let promise2 = $.getJSON('http://www.omdbapi.com/?i=tt0111161');
let promise3 = $.getJSON('http://www.omdbapi.com/?i=tt0109830');
let promise4 = $.getJSON('http://www.omdbapi.com/?i=tt0068646');
let promise5 = $.getJSON('http://www.omdbapi.com/?i=tt0114369');
let promises = [promise1, promise2, promise3, promise4, promise5];
Promise.all(promises).then( res => {
console.log(res);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment