What way (if any) can I get the reference to anonymous function's closure in javascript?
问题 Let us consider the workable code: var storage = {}; (function() { function internalMethod1() { ...; return; } function internalMethod2() { ...; return; } storage.storedMethod = internalMethod1; })(); storage.storedMethod(); Is there any way to call internalMethod2 , if it is not called in internalMethod1 ? In other words, can I access an anonymous closure from outside, if I have access only to one of its functions? 回答1: can I access an anonymous closure from outside? No. Scopes are private