basically i have this function
async function get(url){
const response = await fetch(url);
const resData = await response.text();
return resData;
}
then later i have this call
let data = await get(am_url);
the code works perfectly on google chrome, but on firefox, i get this error on the call line :
SyntaxError: await is only valid in async functions and async generators
what's the problem here, for the life of me, i can't seem to make this work on firefox and can't figure out why
for example if i open google.com on firefox and google chrome, then i go to the console, and pase this code, on chrome, it will run, but on firefox, it will throw the error i mentionned
async function get(url){
const response = await fetch(url);
const resData = await response.text();
return resData;
}
let data = await get("http://google.com");
console.log(data)