I think I understand why variables exist outside the function in which they were declared, because you are returning another function:
myFunction = function() { var closure = 'closure scope' return function() { return closure; } } A = myFunction();
The way it is written now calls A () as a getter.
Q: How can I write myFunction so that the call to A (123) is setter?
source share