Created
March 13, 2021 14:46
-
-
Save NovoManu/526cb0b92ce207b3c44c24d5f645fc1d to your computer and use it in GitHub Desktop.
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
const promise = (duration = 0) => { | |
return new Promise((resolve, reject) => { | |
setTimeout(resolve, duration) | |
}) | |
} | |
promise(1000) | |
.then(() => { | |
console.log('1 sec') | |
return promise(500) | |
}) | |
.then(() => { | |
console.log('1.5 sec') | |
return promise(500) | |
}) | |
.then(() => { | |
console.log('2 sec') | |
return promise(500) | |
}) | |
.then(() => { | |
console.log('2.5 sec') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment