function a(){
console.log(typeof b); // function
function b() {
var c = 52;
console.log(c);
}
var b = 88;
console.log(typeof b); // number
}
Could anyone answer, how javaScript compiles or handles this particular case ? I know javaScript gives preference to function
declaration when it comes to hoisting
. But how a same identifier
b
holds two different values under same block or in same lexical scoping?
Someone could say like, okay, I'm going to use b
as a function
before it's declaration and as number
after assigning it a number
.