function outer(){ var a, b, c; function inner1(){ ... } function inner2(){ ... } inner1(); inner2(); ... }
I want the global namespace to be clean, so I wrote the code above. Internal functions are used only by code inside Outer. But after that, I start to think that this will cause a memory problem. I'm not sure if internal functions were created in advance or created every time external () is called? And will they cause a memory leak?
Can someone help explain what happens when the external () function is called and when it returns? And please write to me if there are good books or articles about javascript memory management. I always confuse such problems. Thanks.
source share