request.onload = function () {
let avg = JSON.parse(this.responseText);
};
This is my side. I have declared a global variable elsewhere. This function is supposed to update the variable so I can use the "updated" 'avg' elsewhere. Can anyone help me to return the variable outside the function?