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. local scope.
- Scope is where idea of where your variables are located in your code. In a local scope,
- like a function block, the instance of that variable can only be used within that function block.
- In a global scope, other functions and files have access to that global variable.
- Why are global variables avoided?
- Global variables should be avoid because other functions and files have access to this variable
- and sometimes they can unintentionally alter that variable.
- Explain JavaScript's strict mode
- Strict mode will require the user to use the keywords 'let' or 'const' in front of variables
- in order to prevent global variables from being altered. Otherwise, it will also throw an error
- in strict mode.
- What are side effects, and what is a pure function?
- Side effects are when functions are unitentially manipulating variables that they werent
- meant to manipulate. A pure function is a function that is deterministic, which means it gives
- the same or intended result each time it runs.
Add Comment
Please, Sign In to add comment