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.
- Javascript's strict mode will send a warning message if your variables are not defined with a let or a const before them.
- 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.
Add Comment
Please, Sign In to add comment