Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. Scope determines whether or not you can access variables depending on where the variable was initialized. It also is the reason why we are able to reuse variables as long as they are not global variables. You avoid making global variables by always making sure your variable is inside a function, this is called a block scope when a variable is correctly inside a function.
  2. Global variables are typically avoided due to their chance of creating side effects, which is when a variable inside a function reaches to a parent function and unwanted changes to variables happen. This could also lead to your function becoming indeterminate(function does not run as intended when given set arguments).
  3. JavaScript's strict mode is a very useful built in tool that helps developers prevent accidents like side effects or indeterminiate functions happen.It does this by triggering an error any time a variable is declared without the key words let or const. You can apply it to the entire file by putting it at the top or you can choose to use it only on a single function.
  4. A pure function is a function that does not contain side effects and is not indeterminate.(Defined Side effects above(2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement