Guest User

Untitled

a guest
Jul 17th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. What is scope? Your explanation should include the idea of global vs. local scope.
  2. Scope is where idea of where your variables are located in your code. In a local scope,
  3. like a function block, the instance of that variable can only be used within that function block.
  4. In a global scope, other functions and files have access to that global variable.
  5.  
  6. Why are global variables avoided?
  7. Global variables should be avoid because other functions and files have access to this variable
  8. and sometimes they can unintentionally alter that variable.
  9.  
  10. Explain JavaScript's strict mode
  11. Strict mode will require the user to use the keywords 'let' or 'const' in front of variables
  12. in order to prevent global variables from being altered. Otherwise, it will also throw an error
  13. in strict mode.
  14.  
  15.  
  16. What are side effects, and what is a pure function?
  17. Side effects are when functions are unitentially manipulating variables that they werent
  18. meant to manipulate. A pure function is a function that is deterministic, which means it gives
  19. the same or intended result each time it runs.
Add Comment
Please, Sign In to add comment