So, I want to use fetched data from an API in my app, but I cannot store the fetched data outside of async function getapi(), but if I use all other functions while staying inside that getapi() function, they are working fine but I want to store the fetched data outside of that function to make my code more readable and clear.
var mdata;
const api_url = "https://api.jsonbin.io/b/602998b0f460fe73a1967fe0";
async function getapi(url) {
    const response = await fetch(url);
    data = await response.json();
    mdata = data;
}
getapi(api_url);
console.log(mdata);

 
     
    