My current dilemma involves attempting to store JSON data in a variable, but I'm clearly missing something crucial. Initially, I successfully see the JSON displayed in the console as desired. However, upon subsequent attempts to access it later on, all that is returned is a promise. How can I properly save the JSON into a variable so that I can utilize the objects within the JSON at a later time?
var jsondata = fetch(url).then(
function(u){ return u.json();}
).then(
function(json){
console.log(json);
}
)
console.log(jsondata);