Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The first example there allows the JS engine to prove to itself that no one uses foo, so it optimizes the reference out of the closure to save memory. That's an optimization (and the fact that the debugger doesn't disable it is actually a bug); the language semantic is that all closed-over variables are available to the closure function body.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: