Skip to content

Instantly share code, notes, and snippets.

@BridgeNB
Created June 26, 2018 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BridgeNB/ed13a4f2a4b931906e2944aeb8389fe1 to your computer and use it in GitHub Desktop.
Save BridgeNB/ed13a4f2a4b931906e2944aeb8389fe1 to your computer and use it in GitHub Desktop.
Answer for scope
1. Scope is the range where variables are defined and validated. Global scope is the environment
where variables are available everywhere in this project.
Local scope is a particular area where variables are vaildated, for example, a function or a file.
2. We have to avoid global variables to aviod misrable bugs.
3. In strict mode, you cannot use a variable without defined it first.
4. Side effects is that one function's output will affect other functions.
Pure funtion is that this function is both determinate and has no side affect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment