Skip to content

Instantly share code, notes, and snippets.

@amazingandyyy
Last active November 17, 2017 22:08
Show Gist options
  • Save amazingandyyy/c38b5428350be0929bb330f44e6c9d82 to your computer and use it in GitHub Desktop.
Save amazingandyyy/c38b5428350be0929bb330f44e6c9d82 to your computer and use it in GitHub Desktop.
const call = async (index) => {
setTimeout(()=>{
console.log(index)
},5000)
}
for (var i=0;i<5;i++) {
await call(i);
}
const call = (index) => {
return new Promise((res, rej) => {
setTimeout(()=>{
console.log(index);
},2000);
})
}
for (var i=0;i<5;i++) {
call(i)
}
@SaifRehman
Copy link

great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment