Language concepts

Declaration initialization (hoisting)

Try the free JavaScript compiler

Informal term for the fact that some bindings exist before the declaration statement executes. Initialization differs by declaration kind: ordinary function declarations in function bodies are initialized to function objects, var to undefined, lexical declarations remain uninitialized until evaluation. No literal moving of source code occurs.

Formal Syntax & Structure

javascript syntaxjavascript
function f() { return g(); function g() { return 4; } }

Working Example

Example Snippetjavascript
function f() { return g(); function g() { return 4; } }console.log(f());
JavaScript Reference