You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
-
2Read something similar in a book once. I prefer this, too, since you don't have to touch your existing code (as much) and it becomes obvious why you did it, once you've learned the self-calling function pattern: to trap that variable in the newly created scope.DanMan– DanMan2013年07月26日 11:18:39 +00:00Commented Jul 26, 2013 at 11:18
-
1@DanMan Thanks. Self calling anonymous functions are very good way to deal javascript's lack of block level variable scope.Kemal Dağ– Kemal Dağ2013年07月26日 12:20:44 +00:00Commented Jul 26, 2013 at 12:20
-
3Self-calling, or self-invoking is not the appropriate term for this technique, IIFE (Immediately-Invoked Function Expression) is more accurately. Ref: benalman.com/news/2010/11/…jherax– jherax2015年10月27日 04:29:35 +00:00Commented Oct 27, 2015 at 4:29
lang-js