Accessing global variable from asynchronous function

#1

How to access global variable from an asynchronous function? I get that global variable is not defined although it is.

#2

Are you sure you have the proper execution context for ‘this’?

#3

what do you mean by that?

I have global variable myVariable;

In constructor I say this.myVariable = "someValue";

and then in an asynchronous method: console.log(this.myVariable);

and get undefined.

Is that what you mean?