Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save matwal42083/a9934a62f3507815e40b32e7ad0dbc9f to your computer and use it in GitHub Desktop.
Save matwal42083/a9934a62f3507815e40b32e7ad0dbc9f to your computer and use it in GitHub Desktop.
Global Scope Example
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