Created
June 8, 2025 23:01
-
-
Save matwal42083/a9934a62f3507815e40b32e7ad0dbc9f to your computer and use it in GitHub Desktop.
Global Scope Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variables are declared outside of blocks. These variables are called global variables. Because global variables are not bound inside a block, they can be accessed by any code in the program, including code in blocks. | |
Example of Global Scope: | |
const color = 'blue'; | |
const returnSkyColor = () => { | |
return color; // blue | |
}; | |
console.log(returnSkyColor()); // blue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment