Last active
November 16, 2018 09:07
-
-
Save andrewlistopadov/53b0ec622be7848466084b5fcd90402d 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
| function getRejectedPromise() { | |
| const promise = new Promise((resolve, reject) => { | |
| reject('some error'); | |
| }); | |
| return promise; | |
| } | |
| let counter = 0; | |
| const interval = setInterval(() => { | |
| if (++counter > 10) clearInterval(interval); | |
| else console.log(`async counter: ${counter}`); | |
| }, 500); | |
| getRejectedPromise() | |
| .then(() => console.log('Never be called. But rejection will not be visible in the console and main thread will be alive.')); | |
| console.log('will be reached'); | |
| setTimeout(() => console.log('2nd async console output'), 3000); | |
| setTimeout(() => console.log('1 async console output'), 0); | |
| setTimeout(() => console.log('last async console output'), 6000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment