As with this reference, Function declaration statement and variable declaration do NOT have block scope. So I am asking for why the code below executed this way.
//javascript es6
{
function bar() {
console.log("1");
}
}
function bar() {
console.log("2");
}
bar(); //prints "1" not "2"
this.bar() //also prints "1" not "2"
what I know is that the code above should consider the two functions in the global scope, but it seems like function declaration is affected by the block scope.