<script> var mutter = function () { var wert = 4711; return function () { return wert; }; } var k0 = mutter(), k1 = k0, k2 = k0(), k3 = mutter()(); </script>
<script> var f, g; function fn() { var x = 0; f = function() { x = x + 1; return x; }; g = function() { x = x - 1; return x; }; x = 1; alert( f() ); /* 1 */ } fn(); alert( g() ); /* 2 */ alert( f() ); /* 3 */ </script>
<script> var wert = 12, a, b, c; a = ( function () { return wert + 1; }() ); b = ( function (val) { return ++val; }(a) ); c = (function (v) { return { v:v }; }(b+a) ); </script>
<script> function add(a) { return function (b) { return a + b; }; } var add22 = add(22); /* 1 */ var x = add22(-7) + add22(-4); alert(x); /* 2 */ </script>
var add22 = function( b ) { return 22 + b; };