let feed;
$.getJSON('short.json', function(data) {
feed = data.items;
console.log(feed);
});
console.log(feed);
I wrote this brief code snippet above. I intended for feed to be a global variable, however once it's outside the function scope, it becomes undefined again. It displays an object while inside the function. What mistake am I making?
Appreciate any assistance provided.