Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- What is scope? Your explanation should include the idea of global vs. block scope.- A scope is a set of rules that define how the variables you declare
- either can or cannot be accessed at different places in your code. Scopes allow other programmers to add to the same code without it breaking.
- Global scope tend to make some side effects happen within code and they should be avoided.Any variable that is defined outside of a function
- is a global scope. However a block scope is only accessible within the function's block of instructions.
- Why are global variables avoided? Global scope tend to make some side effects happen within code.
- Explain JavaScript's strict mode. The JavaScript 'use strict' command can be put at the top of a file to enforce strict mode for the entire file.
- Any time a variable is declared without the let or const keyword, an error will be triggered.
- What are side effects, and what is a pure function? A side effect is when a function reaches outside its local scope up into a parent scope and
- alters a value that lives there. A pure function when it is both determinate and has no side effects within our code.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement