How to return value from async function?
I have tried this but it does not work:
var x;
getText("http://localhost/test/test.html").then(data => {x = data});
async function getText(file) {
let myObject = await fetch(file);
let myText = await myObject.json();
return myText;
}
alert(x);