a guest Nov 17th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- Scope determines the accessibility of variables. Global scope can be defined as when variables can be accessed from anywhere within
- a program, outside of a function. Local scope can be defined as when variables can be accessed from within a function.
- Global variables are avoided because they can cause side effects and they can create indeterminate results, meaning you give
- one input but you receive different results. In addition, global variables can be altered by other functions and the variables
- within those functions if they are not defined with a let or a const, or even create a new global variable.
- A pure function is when a function is determinate and has no side effects. Determinate means when a function is given the
- same inputs, you receive the same value.
- Side effects are when a function reaches outside of its local scope into its parent scope and alters a value that lives there.
RAW Paste Data