Why does calling a function expression before assignment throw a TypeError?
Because the variable is hoisted with undefined (with var). Calling undefined() throws TypeError: x is not a function. Only function declarations are hoisted with their body.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in What Is Hoisting in JavaScript?
Still have questions?
Browse all our FAQs or reach out to our support team
