SHARE
TWEET

Untitled

a guest Oct 20th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1) Scope is a set of rules that defines what part of your code can access a particular variable. Variables with a global scope are declared outside of functions and can be accessed anywhere in your code. Variables with a block scope are declared inside functions and can only be accessed within that function and they also cease to exist after the function stops executing).
  2. 2) Global variables are avoided because they lead to unintended side effects which leads to functions becoming indeterminate.
  3. 3) JavaScript's strict mode raises an error whenever a global variable is declared (aka a variable is declared without let or const). This is best practice.
  4. 4) A side effect is when a function alters a value outside of its local scope. A pure function is one that is determinate and has 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
 
Top