Last active
April 12, 2022 00:36
-
-
Save KenoLeon/2c8a199bd28d8d10e145f6c488dd4953 to your computer and use it in GitHub Desktop.
multiple Promises no chaining
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
| // NO chaining: | |
| const EVM_OPERATION_01 = new Promise((resolve) => { | |
| setTimeout(() => { | |
| resolve('Done with Operation 01'); | |
| }, 600); // timeout of 600ms to simulate the operation | |
| }); | |
| const EVM_OPERATION_02 = new Promise((resolve) => { | |
| setTimeout(() => { | |
| resolve('Done with Operation 02'); | |
| }, 800); // timeout of 800ms to simulate the operation | |
| }); | |
| EVM_OPERATION_01.then(result => { | |
| console.log(result); | |
| }); | |
| EVM_OPERATION_02.then(result => { | |
| console.log(result); | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment