Created
February 25, 2018 09:54
-
-
Save a1exlism/14190b7c5609afde755ab0ab4c0db951 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 asyncFunction() { | |
| return new Promise(function(resolve, reject) { | |
| console.log('Async Hellow World'); | |
| resolve('X'); | |
| }); | |
| } | |
| asyncFunction().then(function (data) { | |
| console.log('Your request was approved, and the variable is ' + data); | |
| }, function(data) { | |
| console.log('The server reject your request'); | |
| }).catch(function(err) { | |
| console.log('Error: ' + err); | |
| }); | |
| /* | |
| * Main Func: success | resolve ; fail | reject == user defined ??? | |
| * Callback: success | then ; fail | catch | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment