Menu
Can anyone explain the codes below better so I may learn how they work?
var g = 100;
function outer (){
var x = 99;
function inner(){
var y = 77;
}
}
Here is the description I have:
Here the code inside the inner function has access to all three variables.
The code inside outer can only access g and x, and the code outside of the
outer function can only see g.
It says the code outside of the outer function can only see g. Does it mean that the code “var g = 100” cannot see anything else except “var g = 100” ?