Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- What is scope? Your explanation should include the idea of global vs. block scope.
- 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
- that can only be used in that block or local code and can not be used globally through out your code.
- Why are global variables avoided?
- ANS: Global variables can have unintended side effects causing cascading problems within your code. The best way to program
- is using pure coding, having the ability to use local or block coding allows your program to be versitile enough for
- unintended changes that a code may incounter while running.
- Explain JavaScript's strict mode
- 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
- What are side effects, and what is a pure function?
- ANS: Side effects can happen when using global variables causing altered effects throughout the code. A pure function is when
- it's actions are determined and has no side effects
Add Comment
Please, Sign In to add comment