Hint
Block-level function declarations behave inconsistently — avoid them. Use function expressions inside blocks.
console.log(typeof foo);
{
function foo() {}
}
console.log(typeof foo);undefined function
Explanation: In non-strict mode, block-level function declarations are partially hoisted to the enclosing function scope but only initialized when the block is reached. Behavior varies across environments.
Key Insight: Block-level function declarations behave inconsistently — avoid them. Use function expressions inside blocks.