Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  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.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement