So I've got a function that calls a callback. It is inside another function
function otherFunction() {
getUserStatus(function(status) {
console.log(status);
});
}
The function getUserStatus()
does all the processing I want, and console.log()
displays the correct variable.
However I can't seem to access the variable outside the scope of the callback function. I want to access it in otherFunction()
I tried creating a variable outside of the callback function (inside of otherFunction()
) by using var status;
and var otherstatus;
and assigning status to these variables, but assigning them to what I would think would be a variable in scope didn't work either.
So how do I get this variable into the scope of the function?