Syntactic sugar over promises that allows writing async code in synchronous style using try/catch.
Solution Code
JavaScript
async function fetchData() {
const res = await fetch(url);
return res.json();
}
Explanation
Async functions always return promises. Await pauses execution until promise settles.Guided Hints
How to handle errors in async/await?
Compare with promise chains