If I define a function like this:
const getName = async () => await Promise.resolve('John');
When I try to call the getName function with async:
const name = await getName();
console.log(`Hi ${name}`);
It throws an error:
const name = await getName();
^^^^^
SyntaxError: await is only valid in async function
What I'm doing wrong?