Last active
November 17, 2017 22:08
-
-
Save amazingandyyy/c38b5428350be0929bb330f44e6c9d82 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 call = async (index) => { | |
setTimeout(()=>{ | |
console.log(index) | |
},5000) | |
} | |
for (var i=0;i<5;i++) { | |
await call(i); | |
} |
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 call = (index) => { | |
return new Promise((res, rej) => { | |
setTimeout(()=>{ | |
console.log(index); | |
},2000); | |
}) | |
} | |
for (var i=0;i<5;i++) { | |
call(i) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
great