I am new to using async functions and promise in javascript. I am trying to fetch some data which is set/created inside the async function which is returned as a promise . How do I fetch this data outside the then() function. Is there any way to do this?
var config={}
//global variable
async function drawGraph(graph) {
//some code
.
.
.
config={
linkStrength: 1,
linkDistance: 20,
nodeStrength: -30,
Size: 4,
restart: reset
};
}
makeRequest().then(data => drawGraph(data));
console.log(config.Size);
// Doesn't work