I'm having a little trouble to understand how scope and hoisting for function declarations is behaving in the following example:
function alpha(){
beta();
if (true === true){
function beta(){console.log('Aloha')};
}
}
alpha();
The above example is in Sloppy Mode, which means, function declarations have Function Scope. According to this, the scope of the function 'beta' should be the block of the function 'alpha'. Also the function declaration 'beta' should be hoisted within the 'alpha' function, nonetheless that is not the case. What am missing here?
Why hoisting is not working?