Prompt
Write hoistingDemo() demonstrating hoisting: call a function BEFORE its declaration
(works — declarations hoist entirely) and read a var BEFORE its assignment (yields undefined).
Return { fnResult, varBeforeInit, myVar } where varBeforeInit is String(myVar) captured
before the assignment (so it's the string 'undefined').
Hints
Solution
Your Code
5 min