function test() {
return new Promise((resolve, reject) => {
resolve('Yay');
});
}
function func() {
return test()
.then((val) => {
return val;
})
.catch((error) => {
console.log('handle reject');
});
}
console.log(func());
I am looking for a way to get the function to return the value from the function call. Right now when we return, we actually return a promise. Whats the ideal way to go about this?