Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. 1-) Scope determines accessibility of a variable in your code. it specify how your codes work and avoid bugs.
  2. Global scope: The area outside of the all functions is considered global. When one variable declares as a global variable, it s also available anywhere in the code. Global scope extends cross files.
  3. Block scope: It s area within conditions or loops and generally speaking whenewer you see curly brackets. Block scope only accessible within the function's block.
  4.  
  5. 2-) Global variables can be altered any part in the code and it s hard to keep track it. That would be cause a side effect .So , your code becomes undeterminete. When you give an input, it can return one result ; another time, it can return with a different value.
  6.  
  7. 3-) Strict mode is using for contributors to make sure that variables declare with let and const. Without these parameters in the strict mode error will appear. Thus, side effects can be eliminate using strict mode.
  8.  
  9. 4-) Side effects generally are caused by global variables. They can be altered anywhere in the code, so interpreters can return different values for different times.
  10. Pure functions are determinate functions which always returned same value and they have no side effects.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement