var Data;
fetch('url')
.then(data => data.json())
.then(success => Data = success);
while(typeof Data === 'undefined'){
console.log("data not retrived")
}
The code above gets me into a forever loop and I don't understand why, Can someone expalain this?