1. What are modules in JavaScript?
Modules are reusable pieces of code that encapsulate related functionality. They help in organizing code, managing dependencies, and promoting reusability.
2. What are closures and how are they implemented in JavaScript?
Closures are functions that have access to the outer function's variables even after the outer function has finished executing. They are implemented by creating a scope chain that remains intact even after the outer function exits.
3. Explain the concept of currying in JavaScript.
Currying is the technique of converting a function that takes multiple arguments into a sequence of functions that each take a single argument.
4. What are generators in JavaScript?
Generators are functions that can be paused and resumed, allowing for more flexible control flow.
5. What are arrow functions in JavaScript?
Arrow functions are a concise way to write anonymous functions in JavaScript, introduced in ES6.
6. Explain the difference between `null` and `undefined` in JavaScript.
`null` is an explicitly assigned value that represents the absence of any object value, while `undefined` indicates a variable that has been declared but has not yet been assigned a value.
7. What is memoization and how is it useful in JavaScript?
Memoization is an optimization technique used to speed up function execution by caching the results of expensive function calls and returning the cached result when the same inputs occur again.
8. What are the different ways to create objects in JavaScript?
Objects in JavaScript can be created using object literals, constructor functions, the `Object.create()` method, and class syntax (introduced in ES6).
9. What is event bubbling and event capturing in JavaScript?
Event bubbling is a mechanism where an event occurring in a child element is propagated up to its parent elements, while event capturing is the reverse process where the event is captured from the top of the DOM hierarchy down to the target element.
