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 where a piece of code takes effect. This is commonly seen in variables. For instance a for loop can create a
- variable the use for its execution but when you try to access that variable name outside the loop, it is non-existant.
- Why are global variables avoided?
- Global variables are avoided because they can cause confusion throughout the code.
- For instance when a global variable is changed, yet the creator/maintenence coders expect it to be set to a certain value,
- the can often change throughout the code.
- Explain JavaScript's strict mode
- Strict mode is used (and useful) to help write maintainable,
- code by eliminating coloqualisism such as ending semicolons or var declarations.
- What are side effects, and what is a pure function?
- Side effects is what happens when a piece of code written has additional results other than what is intended.
- This can be both good and bad.
- A pure function is function that not only has no side effects but also doesn’t rely on side effects. EloquentJavascript
- Explain variable hoisting in JavaScript.
- Hoisting is how the JS interpreter searches for all veriable declarations,
- moves it to the top of the scope its contained in, processes the rest of that code and exits.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement