Promise JavaScript
let promise = new Promise(function(resolve, reject){
try{
resolve("works"); //if works
} catch(err){
reject(err); //doesn't work
}
}).then(alert, console.log); // if doesn't work, then console.log it, if it does, then alert "works"
Unusual Unicorn