0

I tried async function with await fetch and i am getting the result:

http://prntscr.com/mpsp7t

JS code:

async function getjson(){
  await fetch('products.json')
  .then((res) => res.json())
  .then(function(data){
    trick.push(data)
  })
}
getjson();
const trick = [];
console.log(trick)

But how should i access all this data now and have it in variable?

0 Answers0