Back to Developer Roadmap

Global Scope

src/data/roadmaps/javascript/content/global@oC4o6GLEES_nUgCJu9Q6I.md

4.0445 B
Original Source

Global Scope

Variables declared Globally (outside any function) have Global Scope. Global variables can be accessed from anywhere in a JavaScript program. Variables declared with var, let and const are quite similar when declared outside a block.

Note

If you assign a value to a variable that has not been declared i.e potato = true it will automatically become a GLOBAL variable.

Visit the following resources to learn more: