Guest User

Untitled

a guest
Mar 19th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. Scope is about how and when a varible is activated depending on it's place in the code.
  2. Some variables are only active when in a certain block of code, this is known as local scope.
  3. Other variables are active through the entirety of the code, this is global scope.
  4. If a varible is defined within a block of code, or locally, it won't interfere with anything outside it's scope.
  5. However, if a scope is drawn into the block of code from a global scope, the activation of the variable may interfer with the rest of the code.
  6.  
  7. To prevent side effects from variable activation in the global scope, it's best to apply the 'use strict' command at the beginning of coding progams.
  8. This will prompt an error message whenever a variable is not explicetly defined with stric variables like let and const.
  9. These variable declerations will ensure variables are only declered withint he desired scope.
  10. When a fuction has no side effects and always returns a value with a given input it is considered pure, how good, clean code should be.
Add Comment
Please, Sign In to add comment