Asynchronous
async function getFromDb() { let successful = true; if(successful) { return "Kalen"; } throw "Error"; } // use .then on promises to do something with value, .catch and .finally are also available let foo = getFromDb().then((value) => { console.log(value); }).catch((err) => { console.log(err); }); // prints 'Kalen' if true, otherwise 'Error'