Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. Scope refers to the idea that variables can be referenced by multiple levels of code and functions. When a function sees a variable referenced, first it will search for the variable within the function and if it does not find it there (locally), then it will see if it can find the variable referenced outside of a function in the main bloack of code (global) or in another accompanying file.
  2. Global variables should be avoided when possible because they are susceptible to being altered by functions that use them in often unexpected or detremental ways. It also makes it very difficult to trace why a certain variable might be giving a different then expected result because it could be any number of potential functions that altered it.
  3. Javascripts Strict mode creats an error whenever a variable is named without using either Const or Let.
  4. A side effect is when a function creates effects outside of its intended scope. For example if it were to alter a global variable inadvertantly. A function is determinate when it will perform the same everytime as long as the same inputs are passed to it. In order for a punction to be considered 'pure', it needs to be both side effect free and determinate.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement