DRAFT
Observed
Functions cannot be called in the expression in which they are defined
Functions can be immediately called in the expression in which they are defined
There are two ways to define a function:
through a function declaration:
function foo() {} // function declaration
() => {}; // arrow function declaration
through a function expression:
// function expressions
(function foo() {});
const foo = function () {};
const bar = { foo: function () {} }(
// arrow function expressions
() => {}
);
const foo = () => {};
const bar = { foo: () => {} };
Function declarations cannot be immidiately invoked:
Function expressions can be invoked as they are defined:
Function expressions can be named, meaning that it is possible to access the function from within its own scope:
A function expression does not declare the function in the containing scope of the expression.