SHARE
TWEET

Untitled

a guest Oct 21st, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Variable scope assignment
  2.  
  3. What is a scope.
  4.   A scope is when the code reads out a variable it determines if the variable is
  5.   called out in a global scope(which means written out without a function or a local scope(written inside the function).
  6.   If the variable if written globally that means you can call out that variable anywhere in your code, and that creates
  7.   an unorganized code. Writing the variable in a function block only calls it that variable inside that function.
  8.  
  9. Why are global variables avoided.
  10.   The reason global variables are avoided is mainly to avoid using the same variable twice. Which means that your code
  11.   will look unorganized. Global variables are also unintended to have side affects such as going back into the parent
  12.   function and trying to find the variable in the parent function.
  13.  
  14. javaScript ‘strict mode’.
  15.   Always write ‘strict mode’ on the top of every javaScript. Strict mode cleans up the code and every time a variable
  16.   is called out without a “let” or “const” the code will read it as undefined.
  17.  
  18. What are side-effects and pure function.
  19.   A side effect happens when a function reads a variable that was not called out, it reaches the parent function and
  20.   tries to read the code from there. If the function does find the variable in the parent function then it will always
  21.   use that varibale based off what the parent function has it set to.
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