I have some trouble to understand the Javascript execution context
see below code:
<script >
var global_var;
first();
function first() {
var first_var = 'a';
second();
}
function second() {
var second_var = 'b';
console.log(first_var);
console.log(second_var);
}
console.log('in the outer');
//second();
</script>
Based on my understanding, when first function call the second function, the second function is inside first function's execution context, so, the second can also access first function's properties, here is first_var
But, the actually output in function second display "first_var is not defined"
I am confused, could some one give me some explanation?
Thanks in advance.