Pormise vs async wait another example

by Kabir Hossain

JavaScript

//This is how you would implement it using promises
const makeRequest = () =>
  getJSON() // promise fun
    .then(data => {
      console.log(data)
      return "done"
    })

makeRequest();


// And this is how it looks with async/await
const makeRequest2 = async () => {
  console.log(await getJSON())
  return "done"
}

makeRequest2();