How do we call this style?

D

Dmitry A. Soshnikov

How do we call this style?

(function() {

// CODES...

}) ();

Anonymous function expression which executes right after creation.
Usually is used for encapsulate helper-data from the outer context
(e.g. initialization of some objects which returns simple interface to
the outside, but uses some auxiliary stuff inside this function).

In this exact case it should be surrounded with the brackets (grouping
operator) which depends on syntactic rules. But in some other cases
surrounding with brackets for function expressions is not required.

/ds
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,083
Messages
2,570,591
Members
47,212
Latest member
RobynWiley

Latest Threads

Top