Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. 1. What is scope? Your explanation should include the idea of global vs. local scope.
  2.  
  3. A. A Scope is how a variable you declare can be accessed. Global Scope is when a variable is avaliable anywhere in your code.
  4. A local scope is when the variable is inside of the function. Global scope
  5.  
  6. 2. Why are global variables avoided?
  7.  
  8. 2. Global Variables should be avoided because Global Scopes can make unintended side effects.
  9. A side effect is when a function reaches outside its local scope up into a parent scope and alters a value that lives there.
  10.  
  11. 3. Explain JavaScript's strict mode.
  12. A. JavaScript is when at any time a variable is declared without the let or const keyword, an error will be triggered.
  13.  
  14. 4. What are side effects, and what is a pure function?
  15. A. A side effect is when a function reaches outside its local scope up into a parent scope and alters a value that lives there.
  16. A pure function is when both Global and Local variables does not have any side effects.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement