Guest User

Untitled

a guest
Jul 18th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. Scope basically refers to where variables and functions are accessible in a code. There are two types of scope which are global and local.
  2. If something is in global scope then it is accessible anywhere in the code.
  3. If something is in local scope then it is only accessible in a certain part of the code.
  4. Global variables should be avoided because they usually make side effects.
  5. In strict mode, Javascript will cause an error whenever a variable is created without using "let" or "const".
  6. A side effect is when a function makes goes outside of it's local scope and changes a value in the parent scope.
  7. A pure function does not need or modify any variables outside of it's local scope. A pure function always has the same result if given the
  8. same parameters.
Add Comment
Please, Sign In to add comment