Skip to content

Instantly share code, notes, and snippets.

@ramsunvtech
Created February 2, 2018 09:46
Show Gist options
  • Select an option

  • Save ramsunvtech/bdf5191ce7d891657c94903f6c771b16 to your computer and use it in GitHub Desktop.

Select an option

Save ramsunvtech/bdf5191ce7d891657c94903f6c771b16 to your computer and use it in GitHub Desktop.
Simple Promise Example
(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