JavaScript Missing Topics with Explanations
-------------------------------------------
1. Scope
- Determines the accessibility of variables.
- Global Scope: Declared outside functions.
- Function Scope: Declared within a function.
- Block Scope: let & const inside { }.
2. Closures
- A function that remembers variables from its outer scope even after the outer function
has returned.
3. Lexical Environment
- The context in which variables and blocks are defined.
- Each function creates its own lexical environment.
4. The "this" Keyword
- Refers to the object that is executing the current function.
- In arrow functions, "this" is lexically bound.
5. Constructor Functions & Classes
- Constructor: A function used to create objects.
- Class: ES6 syntax to define blueprints for objects.
6. Prototypes & Inheritance
- All JS objects inherit from a prototype.
- Methods and properties can be inherited using prototype chains.
7. Call Stack vs Event Loop
- Call Stack: Executes synchronous code.
- Event Loop: Handles asynchronous code (callbacks, promises).
8. Microtasks vs Macrotasks
- Microtasks: Promises, queueMicrotask.
- Macrotasks: setTimeout, setInterval.
9. Callback Hell
- Nested callbacks leading to unreadable code.
- Can be resolved using Promises or async/await.
10. Debounce vs Throttle
- Debounce: Delay execution until input stops.
- Throttle: Limit how often a function is called.
11. Error Handling
- try...catch for synchronous code.
- async/await with try/catch for async code.
12. Array Methods
- reduce: Accumulates a single result.
- some/every: Test conditions on arrays.
- find: Returns first matching element.
13. Object Utilities
- Object.keys(), Object.values(), Object.entries()
- Useful for looping and transforming object data.
14. ES6+ Features
- Destructuring: Extract values from arrays/objects.
- Spread/Rest: Expand or collect multiple values.
- Optional Chaining: Safe access to deeply nested values.
- Nullish Coalescing: Use default when value is null or undefined.
15. Web APIs
- fetch(): Make HTTP requests.
- localStorage/sessionStorage: Save data in browser.
- FormData: Easily capture form data.
16. JSON Handling
- JSON.stringify: Convert object to JSON string.
- JSON.parse: Convert JSON string to object.
17. Immutability
- Keeping data unchanged.
- Use spread operator or functional methods.
18. Modules
- import/export for reusability.
- Allows splitting JS into multiple files.
19. IIFE (Immediately Invoked Function Expression)
- Runs immediately after definition.
- Useful to create private scope.