Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. // Create promise
  2. var promise = new Promise(function (resolve) {
  3. //Resolve promise in 50ms with string 'success'
  4. setTimeout(function () { resolve('success'); }, 50);
  5. });
  6.  
  7. // Handle successful resolve of promise
  8. promise.then(function (result) {
  9. console.log(result); // Print: success
  10. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement