Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Object JavaScript - Creating promise in ECMAScript
var promise = new Promise(
function (resolve, reject) { // (A)
// ...
if ( /*...*/ ) {
resolve(value); // success
} else {
reject(reason); // failure
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment