Is it possible to 'pass the surrounding scope' to a function defined outside of the scope?
I was trying to make my angular js directives easier to read, and I was wondering if passing the surrounding scope was possible in Javascript. I would like a
to have access to the local
variable:
var a, b;
a = function() {
return console.log('local = ', local);
};
b = function() {
var local;
local = 1;
return a();
};
b();