Advertisement
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.
- A. A Scope is how a variable you declare can be accessed. Global Scope is when a variable is avaliable anywhere in your code.
- A local scope is when the variable is inside of the function. Global scope
- 2. Why are global variables avoided?
- 2. Global Variables should be avoided because Global Scopes can make unintended side effects.
- A side effect is when a function reaches outside its local scope up into a parent scope and alters a value that lives there.
- 3. Explain JavaScript's strict mode.
- A. JavaScript is when at any time a variable is declared without the let or const keyword, an error will be triggered.
- 4. What are side effects, and what is a pure function?
- 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.
- 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