Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scope is how your declared variable can be accessed at a differen point in your code. Scope is categorized into two types: global scope or
- local scope. Global scope can be accessed every point in your code. Therefore, global variables are declared outside a function in JavaScript.
- Local scope is a variable defined in the function. The local variable is access inside the function. Of the two types of variable, global
- variables are best avoided since they have strong tendency for side effects. Side effect is when a function reaches outside of its local scope
- and into parent scope and changes the values of the variables that are in these scopes. Pure function is when your code is free of side effects
- and is determinate. Beside globa or local scope, there is strict mode. To declare strict mode, 'use strict' is declare at the top
- of the code. Also, undeclared variables are not allowed in strict mode since they cause errors.
Add Comment
Please, Sign In to add comment