Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. Scope refers to how accessable certain information is within JavaScript. Scope is either block (local), or global. In the instance
  2. of block scope, the information, such as a variable, will only be available within the container it is in, such as a function. Global scope
  3. however allows the information to be recalled later in your script regardless, and can even be accessed across files.
  4.  
  5. Global variables are avoided because of the likelyhood of creating bugs in your code. When multiple seperate functions rely on a global
  6. variable, it can cause data to be altered and thus alter the outcome of a function inappropriately. Avoiding a variable that is global
  7. preserves the efficiancy of your code, as well as limits your time spent fixing broken code that was improperly altered.
  8.  
  9. JavaScripts strict mode is a convenient way to avoid undeclared variables. Unless using the jQuery library, keeping const or let infront
  10. of your variables is standard. These keywords maintain the purity of our code, as well as mange the variables capabilities. When
  11. implementing strict mode in JavaScript, your code will relay an error anytime your variable is not properly declared with let or const.
  12.  
  13. Side effects are unwanted results that are returned from your functions. They can happen anytime your code is not using proper variables or
  14. relies on global scope for certain variables. Pure code is code that is both determinate, meaning provides consistent results, and has no
  15. side effects. Your code should always be created the oure intent.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement