a guest Apr 19th, 2019 115 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.
  2.   A: Scope interepts the variables declared that can be accesed at various places in your code. Scope determines where you can access the variables in your code.
  3.      Global scope declares a variable outside of a function. Variables inside the global scope can be accessed and altered
  4.      Local scope declares a variable inside of a function . Local scope variables inside of a function can have the same name and serve a different function.
  5.      Variables declared inside a function without var keyword also become global variables.
  7.  Why are global variables avoided?
  8.   A: The code is easier to interpret when it is broken down into smaller parts. Global variables can be read or modified by any part of the code. Which can can cause bugs when calling a function.
  10.  Explain JavaScript's strict mode
  11.   A: Not using let or const causes issues when creating variables. using strict mode at the top of a file or function will cause an error letting you know that a variable was created without using let or const.
  13.   What are side effects, and what is a pure function?
  14.     A: Side effects is when data is modified in a variable of the same name delared as both global and local. Pure functions are when a functions input is accepted and returns a value without modification.
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