Advertisement
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 what kind of access Javascript has to a variable. Global variables are accessable to the entire window object,
- and local variables are only accessible to the objects or functions the variable is in.
- Why are global variables avoided?
- Global variables are generally avoided because with large programs it would be difficult to manage all the unique global variables
- that would be created, and unintended side effects could result. It could also cause functions that you would like to be determinate
- to become indeterminate.
- Explain JavaScript's strict mode
- Strict mode is something you can enable where Javascript will give you an error anytime you declare a variable without the "var" keyword.
- It is good practice to include this in all your Javascript files.
- What are side effects, and what is a pure function?
- Side effects are the unintended consequences of creating a global variable. A pure function means that there aren't any side effects and
- each function is determinate.
- Explain variable hoisting in JavaScript.
- Hoisting is when a variable inside a function is elevated into the global scope. Usually this isn't desired, but in some circumstances it
- is needed.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement