When a variable is declared within a function’s curly braces (using let, const or var) that variable has local scope.
Conversely, when a variable is declared outside a function’s curly braces (using let, const or var) that variable has global scope.
So is scope simply a matter of whether or not a variable is declared inside or outside a function’s curly braces?
For example: In the code below, the initialization expression: var i = 0
contained in the for loop has global scope, correct?
var numArray = [];
for (var i = 0; i < 3; i++) {
numArray.push(i);
}