JS: Function Name Hoisting
Function Declaration Hoist Name and Value
- Function declaration implicitly move (aka hoist) the function name and definition to the top.
- Function expression assigned to variable only hoist the name, not the definition. (in Deno, neither.)
Compare:
console.log(f() === 3); function f() { return 3; }
// deno // error: Uncaught ReferenceError: Cannot access 'g' before initialization g(); const g = function () { return 3; };
JavaScript, Function Declaration vs Function Expression
JavaScript, Function
- JS: Define Function
- JS: Arrow Function
- JS: Function Parameters
- JS: arguments Object
- JS: Function Rest Parameters
- JS: Function Argument Default Value
- JS: Function Argument Destructure
- JS: Function Declaration vs Function Expression
- JS: Closure
- JS: Function Call, Apply, Bind
- JS: Functional Programing
- JS: Function Pipe π
- JS: Function Object
- JS: Function Constructor
- JS: Function.prototype