a guest Feb 13th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- Scope is what determines the visibility/usability of variables within your program. Global variables are ones that can be used anywhere inside of your program (outside of functions) while local variables are ones that are created inside of functions.
- The issue with global variables is that you can increase the chances that you accidentally overwrite the value of a variable with a variable with the same name (unintended side effects). They can create problems in your code that are difficult to find and fix and furthermore, can create indeterminate functions that cause further issues with your program.
- Strict mode is a way to prevent errors in your code. One important feature is that it doesn't allow you to declare variables without using let or const. This allows you to prevent unwanted global variables and also makes sure that your code follows the best guidelines in order to run properly. It changes what used to be bad syntax and creates errors which you can easily read to fix your code.
- Side effects are when a function that is nested, alters the value of something in it's parent scope. Pure functions are ones that don't have side effects and will give you the same output as long as the same input is given.
RAW Paste Data