I am trying to run a function that has Promises inside of and at the end, return a value. When I try logging foo
, it comes back as undefined
. I don't want to return the Promise but just the value I am returning at the bottom of the chain.
let foo = function test() {
new Promise((resolve) => {
resolve();
})
.then(() => {
return "123"
})
}
foo // undefined