What is Scope within Programming.
Scope defines where variables can be accessed or referenced.
What is a block?
Code found inside a set of curly braces.
Example an IF or FUNCTION block.
Can a function access a global and local variable?
Yes a function can call a global variable (Global Scope) and a local variable (Block Scope).
Describe Block Scope.
Variables that are defined inside a block and only accessible within the block. The variable is known as a local variable.
Describe Global namespace.
An temp area where global variables are stored allowing them to be accessed from anywhere in the code. The Global namespace is cleared when the code has finished running.
What is Scope Pollution
Define Tightly Scoping…
The practice of defining variables as tightly as possible using block scope.
Advantages of Tightly Scoping