I'm new to javascript and I tried to implement my first async await and can't figure out where is my problem.
getName() - should return a promise after 1s. f() - should wait for getName to finish and then print name
What am I missing ?
const getName = async () => {
setTimeout(() => 'xxx', 1000)
};
const f = async () => {
name = await getName()
console.log(name)
}
f()