TGViewer
Web Development Web Development @webdevcoursefree · 79.7K subscribers
Post #3427 3.77K
✅ Web development Interview Questions with Answers Part-4

31. What is prototypal inheritance in JavaScript?
JavaScript uses prototype-based inheritance. Objects inherit properties from other objects through the prototype chain. When a property is not found, JavaScript looks up the chain. This avoids duplication and improves memory usage.

32. How does the this keyword behave in different contexts?
In the global scope, this refers to the window or undefined in strict mode. In a function, it depends on how the function is called. In a method, this refers to the object. In arrow functions, this is inherited from the parent scope.

33. What is the difference between shallow copy and deep copy?
Shallow copy duplicates references for nested objects. Deep copy duplicates everything. Shallow copy is faster but risky for nested data. I use structuredClone or JSON methods based on the use case.

34. How does the JavaScript event loop work?
JavaScript is single-threaded. The event loop handles asynchronous tasks. The call stack executes synchronous code first. Async tasks go to task queues. The event loop pushes tasks back to the stack when it is empty.

35. What is the difference between microtasks and macrotasks?
Microtasks have higher priority. Promises use the microtask queue. setTimeout uses the macrotask queue. Microtasks run before the next render cycle.

36. What causes memory leaks in JavaScript and how do you prevent them?
Uncleared timers. Detached DOM nodes. Unused global variables. I remove event listeners and clear intervals. I monitor memory using browser dev tools.

37. What are JavaScript modules and bundlers?
Modules allow code to be split into reusable files. Bundlers combine modules into optimized bundles. They handle dependency graphs and asset loading. Common tools include Webpack and Vite.

38. What is tree shaking and why is it important?
Tree shaking removes unused code from bundles. It reduces file size. It improves load time and performance. It works best with ES modules.

39. What are polyfills and when do you need them?
Polyfills add missing features to older browsers. They replicate modern APIs. I include them only when browser support requires it.

40. What are the different web storage options available in browsers?
Local storage persists data without expiration. Session storage clears on tab close. Cookies store small data and are sent with requests. I avoid storing sensitive data in all of them.

Double Tap ♥️ For Part-5
  • ❤ 15
  • 👍 2
More from @webdevcoursefree
  1. Oct 16, 2026🌐 Web Development Roadmap — Part 18 HTML Lists Lists are used whenever information needs…
  2. Oct 14, 2026🌐 Web Development Roadmap — Part 17 HTML Images — <img> Tag Images make webpages more vis…
  3. Oct 13, 2026𝗧𝗢𝗣 𝗙𝗥𝗘𝗘 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝗧𝗢 𝗕𝗢𝗢𝗦𝗧 𝗬𝗢𝗨𝗥 𝗦𝗞𝗜𝗟𝗟𝗦 𝗜𝗡 𝟮𝟬𝟮𝟲! Explor…
  4. Oct 12, 2026For example: Go to Profile → <a> Submit Form → <button> Open Article → <a> Delete Account…
  5. Oct 12, 2026🌐 Web Development Roadmap — Part 16 HTML Links — Tag Links are one of the most important…
  6. Oct 12, 2026🚀 𝗪𝗵𝗶𝗰𝗵 𝗧𝗲𝗰𝗵 𝗦𝗸𝗶𝗹𝗹 𝗪𝗶𝗹𝗹 𝗬𝗼𝘂 𝗠𝗮𝘀𝘁𝗲𝗿 𝗶𝗻 𝟮𝟬𝟮𝟲? Want to buil…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →