I have this code snippet:
sayHi()
if (1) {
function sayHi() { alert(1) }
} else {
function sayHi() { alert(2) } // <--
}
How is it really working? The functions are defined in the if / else blocks. So how are they scoped outside the if / else blocks?
TypeError: sayHi is not a function