This has been driving me mad for weeks.I have a variable data that I would like accessed at different parts of my program. Like such,
var data = [];
SomeNamespace.module.method(function(){
data.push(['some data']);
});
// data is undefined here
But, it seems to be lost, possibly something to do with scope. How can I get around this?
Thanks in advance!
That function is a callback, so data is not filled until that callback is ran.
So this:
sets data, but: