Skip to content

Instantly share code, notes, and snippets.

@gchavez2
Created July 8, 2018 18:47
Show Gist options
  • Save gchavez2/ea3d0caee8690d72e421ec834af920d3 to your computer and use it in GitHub Desktop.
Save gchavez2/ea3d0caee8690d72e421ec834af920d3 to your computer and use it in GitHub Desktop.
let promiseToCleanTheRoom = new Promise(function(resolve, reject) {
//cleaning the room
let isClean = false;
if (isClean) {
resolve('Clean');
} else {
reject('not Clean');
}
});
promiseToCleanTheRoom.then(function(fromResolve) {
console.log('the room is' + fromResolve);
}).catch(function(fromReject){
console.log('the room is' + fromReject);
})
// From: http://jsfiddle.net/u74L4n1t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment