Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. What is scope? Your explanation should include the idea of global vs. local scope.
  2. Scope is the context in which the variable exists. Global scope has variables declared outside of a function;
  3. local scope includes variables declared within a function and which are only accessible within that function.
  4.  
  5. Why are global variables avoided?
  6. Global variables should be avoided because they are available to the entire document, and could cause
  7. confusion down the line with larger files with lots of lines of code.
  8.  
  9. Explain JavaScript's strict mode
  10. In strict mode, "use strict"; is added to the top of your code, before anything else. It enforces better
  11. programming practices and can prevent errors from occurring or flags errors immediately.
  12.  
  13. What are side effects, and what is a pure function?
  14. A pure function is a specific kind of function that always behaves the same and produces the same
  15. value every time. Functions with side effects can return something other than a value.
  16.  
  17. Explain variable hoisting in JavaScript.
  18. Hosting moves declarations to the top by default.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement