Last active
June 22, 2019 20:54
-
-
Save zemuldo/da44b106cea0ac3392c64722fa3bf929 to your computer and use it in GitHub Desktop.
This is an async code that need to be written to get the desired result.
This file contains 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
function i_am_last_but_i_take_1_sec() { | |
return setTimeout(() => { | |
console.log('i was no: 5 and i take 1 second') | |
}, 1000); | |
} | |
function i_am_fourth_but_i_take_4_sec() { | |
return setTimeout(() => { | |
console.log('i was no: 4 and i take 4 seconds') | |
}, 4000); | |
} | |
function i_am_third_but_i_take_6_sec() { | |
return setTimeout(() => { | |
console.log('i was no: 3 and i take 6 seconds') | |
}, 6000); | |
} | |
function i_am_second_but_i_take_8_sec() { | |
return setTimeout(() => { | |
console.log('i was no: 2 and i take 8 seconds') | |
}, 8000); | |
} | |
function i_am_first_but_i_take_10_sec() { | |
return setTimeout(() => { | |
console.log('i was no: 1 and i take 10 seconds') | |
}, 10000); | |
} | |
function run (){ | |
i_am_first_but_i_take_10_sec() | |
i_am_second_but_i_take_8_sec() | |
i_am_third_but_i_take_6_sec() | |
i_am_fourth_but_i_take_4_sec() | |
i_am_last_but_i_take_1_sec() | |
console.log("Done") | |
} | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment