It is possible to access ther oute scope of a function?
I will explain better.
I’ve a function, from which I want to acccess its calling function scope.
function called() {
// i want to access the calling outer function scope
}
function calling() {
called();
}
obviusly called() function could be called by a lot of calling functions, and called() has to know time to time which function has called him,` and access its scope variables and functions.
You should pass any relevant information into
called()as parameters:If you expect
calledto do different things, and receive different contextual information, depending on who calls it, you should probably make it multiple separate functions.