So, I'm trying to understand the functional context. But there's one thing I don't understand.
How is the variable myVar not able to assign the value 1 to the function b() which has a value of undefined.
Shouldn't it be able to assign the value since it´s part of the global scope?
If I follow what the execution context says with the creation and then execution. It makes sense that javascript shouldn't assign that value because javascript is synchronous. But I've also been taught that global variables have access to local variables.
function b() {
var myVar;
console.log(myVar + "b");
}
function a() {
var myVar = 2;
console.log(myVar + "a");
b();
}
var myVar = 1;
console.log(myVar);
a();