Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scope has to do with the declaration of variables. Specifically, the scope of the variable determines which functions can access it.
- There is local scope, that is variables declared in a function, and global scope, variables declared outside of functions.
- Global variables may cause functions to be indeterminate. Indeterminate functions may have an unintended result. Along with that,
- global variables can collide with others declared in other documents.
- Strict mode requires the declaration of variables with let and const. Without proper declaration an error will be triggered. This
- helps with collision/mutation issues with global variables.
- Side effects of global variable issues would include functions which change a local variable but in fact also change a global.
- Another side effect is if two authors write the same variable with different intentions.
- A pure function is both determinate (has the same intended result every time) and has no side effects.
Add Comment
Please, Sign In to add comment