How to async await in JavaScript

Promise
By Vijay Singh · 
Last updated Feb 28, 2024
(async () => {
  try {
    const response = await fetch("https://codetogo.io/api/users.json");
    const data = await response.json();
    console.log(data);
  } catch (err) {
    console.error(err);
  }
})();
[{
    id: 1,
    name: "Sam"
}, {
    id: 2,
    name: "Alex"
}]
Promises on Learn JavaScript