var y = 1;
if (function f(){}) {
y += typeof f;
}
console.log(y);
I expected that the output would be '1function'. However, the actual output is '1undefined'. As far as I know, function declaration is hoisted and inside if statement has access to the function f. But why it printed out undefined as if function has not been declared?