As discussed here, function definitions can be used before they're defined. But as soon as a section of code is wrapped in a try block, this ceases to be the case.
This displays "Hello world":
hello();
function hello() { alert("Hello world"); }
But this displays "ReferenceError: hello is not defined":
try {
hello();
function hello() { alert("Hello world"); }
} catch (err) {
alert(err);
}
So there is clearly something "special" about a try block with respect to function declarations. Is there any way to get around this behavior?