const foo = "foobar";
function bar(){
const foo = foo || "";
return foo;
}
bar();`
When running this code, it returns an empty string. Why is JavaScript unable to reassign a local variable with the same name as a global variable? Most other programming languages would produce the expected result of "foobar", so why does JavaScript behave differently in this case?