Content deleted Content added
Magioladitis (talk | contribs) partial undo |
As a first example, direct function naming is an extra layer of complexity. Make it more obvious that functions are variables as an introduction. |
||
Line 153:
A simple [[recursion|recursive]] function:
<syntaxhighlight lang="javascript">
if (n === 0) {
return 1;
Line 163:
[[Anonymous function]] (or lambda) syntax and [[Closure (Computer Science)|closure]] example:
<syntaxhighlight lang="javascript">
var count = 0;
return function () {
Line 177:
[[Variadic function]] demonstration (<tt>arguments</tt> is a special [[variable (programming)|variable]]).
<syntaxhighlight lang="javascript">
var i, x = 0;
for (i = 0; i < arguments.length; ++i) {
|