daily pastebin goal


a guest Jul 12th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. What is scope? Your explanation should include the idea of global vs. local scope.
  3. Global scope is when a variable you define is outside of a function and is available to access anywhere in your code.
  4. While block scope is a variable defined inside of a function and disapears afterwards.
  7. Why are global variables avoided?
  9. We avoid globals so that a variable inside of block scope does not reach into its parent scope and alter another variable
  10. (aka side effects).
  12. Explain JavaScript's strict mode.
  14. Once strict mode is enabled (by placing 'use strict' at the top of the file (or inside of a function if that situation was
  15. necessary) makes sure that variables are not defined with out let or const. (aka something = 'something else'). If we try
  16. to define variables while in strict mode it will raise an uncaught reference error.
  18. What are side effects, and what is a pure function?
  19. A side effect is when a funtcion reaches outside of its local scope into its parent scope and alters a value there.
  20. A pure function is one that does not have any side effects and that is also determinate (having the same value given the same inputs).
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand