I'm having promise getting a value from a promise. The promise is supposed to return 123. But X is a promise.
const promise1 = Promise.resolve(123);
const X = promise1.then((v) => { return (v) })
const X = async () => await promise1.then((v) => { return (v) })
I've checked online example, they mostly do a console.log inside then which shows that the value is there but when I return it inside then, it will give me a promise.
I've also read that the promise will result in a promise which is happening here.
So how can I get the value back ?
Thanks !!!
Update:
My program is not async. I've also tried
const X = await promise1
which was suggested in a comment. I get a red line below it. So I've tried
const X = async () => await promise1
and I still get a promise.