Guest User

Untitled

a guest
Feb 16th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. What is scope? Your explanation should include the idea of global vs. block scope.
  2. ANS: A global is a variable that can be used through out the course of the document, a block or local variable is a variable
  3. that can only be used in that block or local code and can not be used globally through out your code.
  4.  
  5. Why are global variables avoided?
  6. ANS: Global variables can have unintended side effects causing cascading problems within your code. The best way to program
  7. is using pure coding, having the ability to use local or block coding allows your program to be versitile enough for
  8. unintended changes that a code may incounter while running.
  9.  
  10. Explain JavaScript's strict mode
  11. ANS: JavaScript strict is used to help in pure coding when ever a variable is used with out let or const and error will occur
  12.  
  13. What are side effects, and what is a pure function?
  14. ANS: Side effects can happen when using global variables causing altered effects throughout the code. A pure function is when
  15. it's actions are determined and has no side effects
Add Comment
Please, Sign In to add comment