I need help on this issue I'm experiencing (I have already searched Stack overflow extensively but could not solve it on my own).
I have the following "dummy" logic to test async/await behaviour:
const data = [1, 2, 3]
async function newData() {
return data
}
async function getData() {
const fetchedData = await newData();
return fetchedData
}
console.log(
(async () => await getData())()
)
Even though I have awaited for all Promise fulfillings, the following data is returned from the console log:
What am I doing wrong? Why doesn't the Promise return the value but remains pending even though it is 'fulfilled'?
Thanks in advance.