Created
February 2, 2018 09:46
-
-
Save ramsunvtech/bdf5191ce7d891657c94903f6c771b16 to your computer and use it in GitHub Desktop.
Simple Promise Example
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 simple() { | |
| let serviceResponse = new Promise((resolve, reject) => { | |
| setTimeout(() => resolve(‘Success’), 2000); | |
| }); | |
| serviceResponse.then((msg) => { | |
| console.log(`Hello Message is ${msg}`); | |
| }, () => { | |
| console.log(‘oops!its rejected’); | |
| }); | |
| }()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment