OutputNot attempted
Calling function expressions early
try { sayHi();} catch (e) { console.log(e.name);}try { sayBye();} catch (e) { console.log(e.name);}var sayHi = function () { console.log('hi');};const sayBye = () => console.log('bye');Spaces and quote style don’t matter · write a thrown error as TypeError
Ctrl Enter
Show answer & explanation
The expected output comes from actually running the snippet; opening this shows it next to the explanation.
Only the var sayHi declaration is hoisted (as undefined), so calling it is calling undefined → TypeError. const sayBye is in the TDZ → ReferenceError.