In the function, running normally, this displays "Hello world":
function fn () {
function b1 () {}
var b1 = 'Hello world';
console.log(b1);
}
fn();
At the block statement, get an error: Uncaught SyntaxError: Identifier 'b1' has already been declared
function fn () {
if (true) {
function b1 () {};
var b1 = 'Hello world';
console.log(b1);
}
}
fn();
So there is clearly something "special" about a block statement with respect to function declarations. why?