Created
July 22, 2020 13:38
-
-
Save mishelashala/eceaa31c4c922731830d88f6448f7d64 to your computer and use it in GitHub Desktop.
This file contains 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
// Promise<number> | |
var promisedNumber = new Promise(function asyncUnitOfWork(fulfill, reject) { | |
setTimeout(function () { | |
fulfill(10) | |
}, 1000) | |
}); | |
console.log('start') | |
promisedNumber.then( | |
function onFulfilled(value) { | |
console.log('value: ', value) | |
}, | |
function onRejected(err) { | |
console.log('error: ', err.message) | |
} | |
) | |
console.log('finish') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment