Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #14826 > unrolled thread

FAQ Topic - What is (function(){ /*...*/ })() ? (2012-07-03)

Started by"FAQ server" <javascript@dotinternet.be>
First post2012-07-02 23:00 +0000
Last post2012-07-02 22:58 -0500
Articles 2 — 2 participants

Back to article view | Back to comp.lang.javascript


Contents

  FAQ Topic - What is (function(){ /*...*/ })() ? (2012-07-03) "FAQ server" <javascript@dotinternet.be> - 2012-07-02 23:00 +0000
    Re: FAQ Topic - What is (function(){ /*...*/ })() ? (2012-07-03) Spamless <Spamless@Nil.nil> - 2012-07-02 22:58 -0500

#14826 — FAQ Topic - What is (function(){ /*...*/ })() ? (2012-07-03)

From"FAQ server" <javascript@dotinternet.be>
Date2012-07-02 23:00 +0000
SubjectFAQ Topic - What is (function(){ /*...*/ })() ? (2012-07-03)
Message-ID<4ff227fa$0$283$14726298@news.sunsite.dk>
-----------------------------------------------------------------------
FAQ Topic - What is (function(){ /*...*/ })() ?
-----------------------------------------------------------------------

This is an anonymous FunctionExpression that is called
immediately after creation.

Variables declared inside a function are not accessible from
outside the function. This can be useful, for example, to hide
implementation details or to avoid polluting the global scope.

<URL: http://yura.thinkweb2.com/named-function-expressions/>
<URL: http://jibbering.com/faq/notes/closures/>
<URL: http://dmitrysoshnikov.com/ecmascript/chapter-5-functions/#question-about-surrounding-parentheses>


The complete comp.lang.javascript FAQ is at
http://jibbering.com/faq/

-- 

The sendings of these daily posts are proficiently hosted
by http://www.pair.com.

[toc] | [next] | [standalone]


#14829

FromSpamless <Spamless@Nil.nil>
Date2012-07-02 22:58 -0500
Message-ID<XpmdnckTh7Rr8G_SnZ2dnUVZ_vGdnZ2d@inch.com>
In reply to#14826
On 2012-07-02, FAQ server <javascript@dotinternet.be> wrote:
> -----------------------------------------------------------------------
> FAQ Topic - What is (function(){ /*...*/ })() ?
> -----------------------------------------------------------------------
>
> This is an anonymous FunctionExpression that is called
> immediately after creation.

I have seen that sort of thing on a spammer page or two.
/*...*/ is ... not a regular expression ... it is just ...
a comment.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web