SHARE
TWEET

Untitled

a guest Aug 20th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. What is scope? Your explanation should include the idea of global vs. block scope.: Scope is a javascript function that allows you to use the same variable throughout your code without altering first function.  Global code will affect entire code vs Block code will only apply inside function.
  2. Why are global variables avoided?: Global variables can be easily faulted to allow bugs and be faulty by allowing it to look outside of function for variables.
  3. Explain JavaScript's strict mode: Javascript has a script mode that you can include at the top of each js file by choice to be sure to always use 'let' or 'const' or an error will occur.  Without 'let' or 'const' a variable can be created if the global scope was not defined or mutated if it was.
  4. What are side effects, and what is a pure function?: A side effect is when the function reaches outside into a parent element and alters a value outside of its scope.  On the other hand, a pure function is when a function is written so the function will always return same value with no side effects.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top