Content deleted Content added
Andy Dingley (talk | contribs) m Reverted 1 edit by 122.176.77.113 (talk) identified as vandalism to last revision by Jesant13. (TW) |
|||
Line 161:
</syntaxhighlight>
[[Anonymous function]] (or lambda) syntax and [[Closure (Computer Science)|closure]] example:
<syntaxhighlight lang="javascript">
function displayClosure() {
var count = 0;
return function () {
return ++count;
};
}
var inc = displayClosure();
inc(); // returns 1
inc(); // returns 2
inc(); // returns 3
</syntaxhighlight>
[[Variadic function]] demonstration (<tt>arguments</tt> is a special [[variable (programming)|variable]]).
|