Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. What is scope? Your explanation should include the idea of global vs. local scope.
  2. Scope is where a piece of code takes effect. This is commonly seen in variables. For instance a for loop can create a
  3. variable the use for its execution but when you try to access that variable name outside the loop, it is non-existant.
  4.  
  5. Why are global variables avoided?
  6. Global variables are avoided because they can cause confusion throughout the code.
  7. For instance when a global variable is changed, yet the creator/maintenence coders expect it to be set to a certain value,
  8. the can often change throughout the code.
  9.  
  10. Explain JavaScript's strict mode
  11. Strict mode is used (and useful) to help write maintainable,
  12. code by eliminating coloqualisism such as ending semicolons or var declarations.
  13.  
  14. What are side effects, and what is a pure function?
  15. Side effects is what happens when a piece of code written has additional results other than what is intended.
  16. This can be both good and bad.
  17. A pure function is function that not only has no side effects but also doesn’t rely on side effects. EloquentJavascript
  18.  
  19. Explain variable hoisting in JavaScript.
  20. Hoisting is how the JS interpreter searches for all veriable declarations,
  21. 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