I have code like this
let newUrl = url.toString()
let storedData = [];
fetch(newUrl)
.then((response) => {
return response.json();
})
.then((data) => {
storedData = data;
});
console.log(storedData)
I would like to be able to get to the data from fetch, but even if I want the data to be added to the storedData list, the script throws an empty list anyway.
If I try to check the data I have with fetch in .then I normally get the answer I want.