Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scope basically refers to where variables and functions are accessible in a code. There are two types of scope which are global and local.
- If something is in global scope then it is accessible anywhere in the code.
- If something is in local scope then it is only accessible in a certain part of the code.
- Global variables should be avoided because they usually make side effects.
- In strict mode, Javascript will cause an error whenever a variable is created without using "let" or "const".
- A side effect is when a function makes goes outside of it's local scope and changes a value in the parent scope.
- A pure function does not need or modify any variables outside of it's local scope. A pure function always has the same result if given the
- same parameters.
Add Comment
Please, Sign In to add comment