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.
- A scope is ability for a variable to be used in certain fuctions. A global scope is a variable that
- will be used in every function that calls it. a local scope for a vaiable will only have its value
- used in the function that its defined in.
- Why are global variables avoided?
- With a global variable, every funtion that calls the same global variable name can get the same value from it
- which can lead to several functions returning unepected values.
- Explain JavaScript's strict mode.
- its a statment that puts javascript into a mode that throws errors when you do certain actions, such as accessing
- certain global variables
- What are side effects, and what is a pure function?
- A side effect is when a function reaches outside its local scope up into a parent scope and alters a value that lives there.
- pure function gives a consistant predictable value, and has no side effects
Add Comment
Please, Sign In to add comment