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. local scope.
- Scope is the context in which the variable exists. Global scope has variables declared outside of a function;
- local scope includes variables declared within a function and which are only accessible within that function.
- Why are global variables avoided?
- Global variables should be avoided because they are available to the entire document, and could cause
- confusion down the line with larger files with lots of lines of code.
- Explain JavaScript's strict mode
- In strict mode, "use strict"; is added to the top of your code, before anything else. It enforces better
- programming practices and can prevent errors from occurring or flags errors immediately.
- What are side effects, and what is a pure function?
- A pure function is a specific kind of function that always behaves the same and produces the same
- value every time. Functions with side effects can return something other than a value.
- Explain variable hoisting in JavaScript.
- Hosting moves declarations to the top by default.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement