Review: Scope
Scopeis the idea in programming that some variables are accessible/inaccessible from other parts of the program.Blocksare statements that exist within curly braces {}.Global scoperefers to the context within which variables are accessible to every part of the program.Global variablesare variables that exist within global scope.- Block scope refers to the context within which variables are accessible only within the block they are defined.
Local variablesare variables that exist within block scope.Global namespaceis the space in our code that contains globally scoped information.Scopepollution is when too many variables exist in a namespace or variable names are reused.