1. Explain the event loop, call stack, and task queue. How does JavaScript handle asynchronous operations?
What happens when setTimeout, Promise, and async/await are used together?
🧠 2. What is the difference between null, undefined, and undeclared variables?
Bonus: What is the result of typeof null?
🌀 3. How does JavaScript handle closures? Can you give a real-world use case?
js
Copy
Edit
function outer() {
let count = 0;
return function inner() {
return ++count;
};
}
⛓️ 4. What is a promise chain and how does it differ from async/await?
When would you prefer one over the other?
⚙️ 5. What is the difference between == and ===? What are the edge cases for type coercion in JavaScript?
Explain: [] == ![]
Explain: [] + [], [] + {} and {} + []
🧩 6. What is hoisting in JavaScript? What gets hoisted and what doesn’t?
What’s the difference in hoisting between var, let, and const?
🧬 7. Explain prototypal inheritance vs classical inheritance. How does JavaScript’s prototype chain work?
🏗️ 8. What are JavaScript modules and how do ES6 modules differ from CommonJS?
How would you implement a module loader?
🕸️ 9. How does the this keyword work in different contexts (global, object method, arrow function, etc.)?
js
Copy
Edit
const obj = {
method() {
console.log(this);
}
};
const fn = obj.method;
fn(); // What is `this` here?
📚 10. What is the difference between Object.freeze(), Object.seal(), and Object.preventExtensions()?
Which one allows you to modify properties but not add or delete?