Content deleted Content added
Mladifilozof (talk | contribs) m →Usage |
Waldron.rick (talk | contribs) m Douglas Crockford did not invent or coin his own function invocation syntax. That was deliberately designed and defined by the grammar of ES3 Tag: references removed |
||
Line 3:
==Usage==
Immediately-invoked function expressions may be written in a number of different ways.<ref name=Enlighten>{{cite book|last=Lindley|first=Cody|title=JavaScript Enlightenment|year=2013|publisher=O'Reilly|isbn=9781449342883|pages=61}}</ref> A [[Coding conventions|common convention]] is to enclose the function expression (and optionally its invocation
<syntaxhighlight lang="JavaScript">
(function () { … })();
(function () { … }());
</syntaxhighlight>
Line 15:
-function () { … }();
+function () { … }();
void function () { … }();
</syntaxhighlight>
|