parentFunction() , var child. child() , parentFunction().
parentFunction(); , , . :
parentFunction()();
: http://jsfiddle.net/USCjn/
: :
function outer() {
return function() {
alert('inner function called');
}
}
x = outer();
x();
: http://jsfiddle.net/bBqPY/
JavaScript ( ( ...)). , , , , , . , . :
x = f();
- f , ( , , , ) x. :
x = f()();
- f, , ( ) x .
f , . . JavaScript , - , , .
, JavaScript.
2016
, :
function outer() {
return function() {
alert('inner function called');
}
}
:
let outer = () => () => alert('inner function called');
ES6 .