Guest User

Untitled

a guest
Nov 17th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. Scope determines the accessibility of variables. Global scope can be defined as when variables can be accessed from anywhere within
  2. a program, outside of a function. Local scope can be defined as when variables can be accessed from within a function.
  3.  
  4. Global variables are avoided because they can cause side effects and they can create indeterminate results, meaning you give
  5. one input but you receive different results. In addition, global variables can be altered by other functions and the variables
  6. within those functions if they are not defined with a let or a const, or even create a new global variable.
  7.  
  8. Javascript's strict mode will send a warning message if your variables are not defined with a let or a const before them.
  9.  
  10. A pure function is when a function is determinate and has no side effects. Determinate means when a function is given the
  11. same inputs, you receive the same value.
  12.  
  13. 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