I'm trying to create a simple web scraper:
var url = "sadasd";
var obj;
fetch(url)
.then(res => res.json())
.then(data => obj = data)
.then(() => console.log(obj))
My question is, why can't I access the obj
variable outside the fetch with something like console.log(obj);
?