a guest Apr 18th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- 1. What is scope? Your explanation should include the idea of global vs. local scope.
- A. A Scope is how a variable you declare can be accessed. Global Scope is when a variable is avaliable anywhere in your code.
- A local scope is when the variable is inside of the function. Global scope
- 2. Why are global variables avoided?
- 2. Global Variables should be avoided because Global Scopes can make unintended side effects.
- A side effect is when a function reaches outside its local scope up into a parent scope and alters a value that lives there.
- 4. What are side effects, and what is a pure function?
- A. A side effect is when a function reaches outside its local scope up into a parent scope and alters a value that lives there.
- A pure function is when both Global and Local variables does not have any side effects.
RAW Paste Data