Created
February 16, 2020 09:50
-
-
Save njofce/8419dae1fdbfbd54607cf5e616d35905 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
| var promise1 = new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| resolve(1) | |
| }, 5000); | |
| }); | |
| var promise2 = new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| resolve(2) | |
| }, 2000); | |
| }); | |
| promise1 | |
| .then(res => { | |
| console.log("MESSAGE: " + res); | |
| return promise2; | |
| }) | |
| .then(res2 => console.log(res2)) | |
| .catch(err => console.log("ERROR: " + err)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment