What is this practice called in JavaScript?
When you wrap your JavaScript code in a function like this: (function(){ var field = …; function doSomthing(){… … })(); I noticed that this fixes scoping problems for me on a lot of web pages. What is this practice called? Answer The pattern is called self-invocation, a self-invoking function. It can create a closure, but … Read more