I\'m trying to learn async-await. In this code -
const myFun = () => { let state = false; setTimeout(() => {state = true}, 2000); return
If you're using async/await, all your calls have to use Promises or async/await. You can't just magically get an async result from a sync call.
Your final call needs to be:
getResult().then(response => console.log(response));
Or something like:
(async () => console.log(await getResult()))()