Im trying to save data from GET request into variable using node-fetch, but i got the some result! When i console log the response, i can see it. But when i assign the resData into variable, i get undefined.
const fetch = require('node-fetch');
async function fetchData(){
const response = await fetch(url, options)
const resData = await response.json();
console.log(resData);
return resData;
};
let myApps
fetchData((data)=>{
myApps = data;
});
console.log(myApps);
result ==> undefined
Someone can help ME!