I am new to JavaScript, and while learning I got confused. Not sure about title of the question.
Coming straight to point -
var a = 4,
say = console.log,
globalA; // defined global variable's
doSome();
doSomeMore();
function doSome() {
say(a);
var a = 5;
say(++a);
}
function doSomeMore() {
say(a);
}
When I run it, this gives
undefined
6
4
Why is this when doSome executes it has value of a as undefined and not 4 ?