Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scope is the area in which the program executes or is affected by. In terms of global vs local, global is for the whole program throughout it all
- Where as local or block scope is only for the function you write in the program.
- Global variables are avioded because you want to avoid side effects which is when a value is changed from the local scope to the parent one or indeterminantes where a variable will return a certain value sometimes and another value other times
- when one enables strict mode throught the whole program if you dont change the variable with let or const an error will occur
- side effects are when a set value in a local scope also changes in the parent scope
- to be pure you need to have no side effects and no indeterminants
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement