var employeeId = 'abc123';
function foo() {
employeeId = '123bcd';
return;
var employeeId = function(){}
}
foo();
console.log(employeeId);
I am new to javascript programming, could someone explain to me why above output is 'abc123' not '123bcd', I thought the employeeId defined inside foo() should be global variable and overwrite the outside one, am I wrong?