JavaScript Promises
let promiseToCleanRoom = new Promise(function(resolve, reject){
//Clean the room -> The promise work is done here..
let isClean = true;
if(isClean)
{
resolve('Clean');
}
else
{
reject('Trashed Bro!');
}
});
promiseToCleanRoom.then(function(fromResolve){
console.log('the room is ' + fromResolve );
}).catch(function(fromReject){
console.log('the room is ' + fromReject );
})