Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create promise
- var promise = new Promise(function (resolve) {
- //Resolve promise in 50ms with string 'success'
- setTimeout(function () { resolve('success'); }, 50);
- });
- // Handle successful resolve of promise
- promise.then(function (result) {
- console.log(result); // Print: success
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement