function foo(a)
{
var b = a*2;
function bar(c)
{
console.log(a,b,c);
var c= 3;
}
bar(4);
var c= 4;
var a= 2;
}
foo(1);
Why c is not 3 here? In spite of the fact that var c= 3 , is defined in the lexical scope of bar() , Why var c =4 is picked even though it is defined below the bar() call ? Please help me understand how these values are picked and assigned to the variables.