Last active
February 27, 2019 21:41
-
-
Save tmocellin/3684d469f0374d318babc2ba9ebcd988 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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