-
-
Save tikotus/d5a80a59f8db3b7eaaedbb7daa17d0ac 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
setTimeout(() => { | |
console.log("hello") | |
setTimeout(() => { | |
console.log("world") | |
}, 1000) | |
}, 1000) | |
const setTimeoutPromise = function(text) { | |
return new Promise((resolve) => { | |
setTimeout(() => { | |
console.log(text) | |
resolve() | |
}, 1000) | |
}) | |
} | |
setTimeoutPromise("hello") | |
.then(() => setTimeoutPromise("world")) | |
.then(() => setTimeoutPromise("1")) | |
.then(() => setTimeoutPromise("2")) | |
.then(() => setTimeoutPromise("3")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment