Is this a property of JavaScript or the engine running it? This feels like something a sufficiently-smart™ closure implementation should be able to prevent.
You really do have to know the quirks of what you're targeting.
Well, the reference lua implementation handles this case fine, and it's a solid but not at all smart™ codebase.