Created
July 8, 2018 18:47
-
-
Save gchavez2/ea3d0caee8690d72e421ec834af920d3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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