function bar() {
foo = 10; // define global variable named foo
return; // the function return value is "undefined"
function foo() {} // define a function named "foo" inside bar function, which means `foo = 10` inside function bar() becomes local variable declaration because "foo" is already defined.
}
So the global variable foo is not impacted at all.