What is Scope?
Scope determines the availability (visibility, or accessibility) of variables.
Types of Scope
- Global Scope
- Local Scope
When a variable is declared outside a function, then the variable is said to be Global.
Global variable is accessible for all scripts and functions on a web page.
External Global Scope
Accessing the above global variable txt by including the source path in the script tag.
Note: The external file should be included before the calling of the variable.
When you assign a value to a variable (inside a functon) that has not been declared, it will automatically become a GLOBAL variable.
Please do google search for:
Join Our Channel
This channel is primarily useful for Full Stack Web Developer.