Created
October 21, 2021 09:20
-
-
Save flxxyz/917d4620c40413b47823165a56ab5f34 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
Promise.resolve() | |
.then(() => { | |
return new Promise((resolve) => { | |
setTimeout(() => { | |
resolve(1); | |
}, 3000); | |
}); | |
}) | |
.then((res) => { | |
console.log(res); // 这里就是 1 | |
return 2; | |
}) | |
.then((res) => { | |
console.log(res); // 这里就是 2 | |
return new Promise((resolve) => { | |
setTimeout(() => { | |
resolve(3); | |
}, 1000); | |
}); | |
}) | |
.then((res) => { | |
console.log(res); // 这里就是 3 | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment