Currently, I am facing an issue accessing the variable emoji_map
beyond the scope of the then
function in my code and I'm unsure how to resolve it.
Below is the relevant snippet of my code:
if (req) {
fetch(req).then(function(response) {
return response.json();
}).then(function(response) {
/* Begin observing */
emoji_map = response.emoji_map;
console.log(emoji_map);
});
}
Whenever I attempt to access emoji_map
outside the if loop using a console.log()
, I cannot retrieve the assigned response value. Could someone assist me with this?