Commonly asked JavaScript interview questions.
𝗕𝗮𝘀𝗶𝗰𝘀
• What are arrow functions in JavaScript, and how do they differ from regular
functions?
• What are truthy and falsy values in JavaScript, and why are they important?
• What is type coercion in JavaScript, and can you explain tricky examples?
• What is the difference between a function declaration and a function expression?
• What is an Immediately Invoked Function Expression (IIFE), and why is it used?
• What are default parameters in functions, and how do they work?
• What is the difference between null and undefined in JavaScript?
• What are symbols in JavaScript, and when would you use them?
• What are getter and setter methods in objects, and how do they help?
• What is the difference between shallow copy and deep copy in JavaScript?
𝗔𝘀𝘆𝗻𝗰
• What are microtasks and macrotasks in JavaScript, and how are they handled in the
event loop?
• What is the difference between Promise.all() and Promise.allSettled()?
• How can you cancel or set a timeout for a promise in JavaScript?
• What is the difference between async/await and generators for asynchronous code?
• What is a race condition in async JavaScript, and how do you prevent it?
𝗘𝗦𝟲+
• What is optional chaining (?.) in JavaScript, and how does it simplify code?
• What is nullish coalescing (??), and how is it different from the logical OR (||)
operator?
• What are private class fields in JavaScript, and why are they important?
• How does the Array.at() method work, and why is it useful?
• What are WeakMap and WeakSet in JavaScript, and how do they differ from Map and
Set?
𝗢𝗯𝗷𝗲𝗰𝘁𝘀 & 𝗔𝗿𝗿𝗮𝘆𝘀
• What is destructuring with default values in JavaScript, and why is it useful?
• How do you merge arrays and objects in modern JavaScript?
• What is the difference between Array.some() and Array.every()?
• How does the Array.reduce() method work, and what are practical use cases?
• What is immutability in JavaScript, and how can you achieve it with arrays and
objects?
𝗖𝗼𝗻𝗰𝗲𝗽𝘁𝘀
• What is currying in JavaScript, and when should you use it?
• How do JavaScript classes work under the hood, compared to prototypes?
• What is the difference between ES6 modules and CommonJS modules?
• What is the difference between prototypal inheritance and classical inheritance?
• What is memoization in JavaScript, and how does it improve performance?
𝗕𝗿𝗼𝘄𝘀𝗲𝗿
• What is the difference between localStorage, sessionStorage, and cookies in
JavaScript?
• What is the Shadow DOM in JavaScript, and how does it help web components?
• What is the difference between throttling and debouncing in JavaScript?
• What are service workers in JavaScript, and how do they enable offline
applications?
• How do you manage memory efficiently in JavaScript applications?