await window.fetch code example
Example 1: fetch await
async function getUserAsync(name)
{
let response = await fetch(`https://api.github.com/users/${name}`);
let data = await response.json()
return data;
}
getUserAsync('yourUsernameHere')
.then(data => console.log(data));
Example 2: javascript async fetch file html
async function () {
element.innerHTML = await (await fetch('./filetofetch.html')).text();
}