Skip to content

Instantly share code, notes, and snippets.

@tmocellin
Last active February 27, 2019 21:41
Show Gist options
  • Save tmocellin/3684d469f0374d318babc2ba9ebcd988 to your computer and use it in GitHub Desktop.
Save tmocellin/3684d469f0374d318babc2ba9ebcd988 to your computer and use it in GitHub Desktop.
const response = [];
var promises = [];
var i = 44;
while(i <= 46){
promises.push(
fetch('https://jsonplaceholder.typicode.com/posts/'+i.toString()).then(result =>{
return result.json()
}).then( jsonResult => {
return jsonResult;
})
);
i++;
}
Promise.all(promises).then(values => {
console.log(values);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment