Async/await in javascript?

Example:


  async function fetchData() {
      let response = await fetch('https://api.example.com/data');
      let data = await response.json();
      console.log(data);
  }
  fetchData();
  

Solution:

Async/Await in JavaScript provides a more readable way to handle asynchronous operations compared to callbacks and promises. It makes asynchronous code look and behave a bit more like synchronous code.

Beginner's Guide to JavaScript