I have some functions and variables:
function b() {
  myvar = 1;
  console.log(myvar);
  a();
}
myvar = 5;
a();
b();
a();
function a() {
  console.log(myvar);
}The console log output is: 5, 1, 1, 1. Why is the last a() call getting "1" as output and not "5" ? Because I thought a() is called from global context, and this global context has myvar=5 as its outer (one level up) variable?
 
    