Scope determines where your variables can be seen, accessed, or used in your code. Think of scope as a security border around your variables.
1. Global Scope: Variables declared outside of any function or code block {}. They can be accessed from anywhere in your entire JavaScript file.
2. Block / Local Scope: Variables declared inside a specific code block {} (like inside an if statement, loop, or function). They exist only inside those curly braces and cannot be seen from the outside.
Modern JavaScript uses let and const, which respect Block Scope {}. Legacy JavaScript used var, which ignores block boundaries and leaks outside curly braces!