HomeAbout Me

JavaScript interview questions

By Daniel Nguyen
Published in Javascript
April 24, 2025
2 min read

2-Pointer Questions

  • 3. Longest Substring Without Repeating Characters
  • 5. Longest Palindromic Substring
  • 845. Longest Mountain in Array
  • 322. Coin Change
  • 377. Combination Sum IV
  • 20. Valid Parentheses
  • 26. Remove Duplicates from Sorted Array

🔥 Core JavaScript (Deep Dive)

  1. Explain event loop and microtasks vs macrotasks. How does async/await fit into this model?
  2. What are closures? How are they used in memory leaks, module patterns, or callback handlers?
  3. Difference between var, let, and const. When would you intentionally use var?
  4. What is hoisting? How does it affect function expressions and variable declarations?
  5. What is the difference between shallow copy and deep copy? How would you implement a deep copy function?
  6. Explain the behavior of this in different contexts. Arrow functions vs normal functions.
  7. What is the difference between Object.freeze(), Object.seal(), and Object.preventExtensions()?
  8. How does prototypal inheritance work in JavaScript? How would you polyfill Object.create()?

⚙️ Async Programming

  1. What’s the difference between Promises and Observables? When would you use each?
  2. How would you implement your own Promise.all()?
  3. What’s the behavior of async functions with error handling? How would you handle both sync and async errors in a utility?
  4. How would you debounce and throttle user input? Bonus: implement both.
  5. How would you cancel a fetch request or handle multiple race conditions in JS?

📦 Performance and Optimization

  1. What causes memory leaks in JS? How can you detect and prevent them?
  2. How do you optimize rendering in large-scale SPAs?
  3. How do you lazy-load modules and components in JavaScript apps (without frameworks)?
  4. What is event delegation and how does it help performance?
  5. How would you implement virtual scrolling or infinite scroll in a list-heavy UI?

🔧 Code Design & Patterns

  1. Explain the Module Pattern in JavaScript. How do IIFE and closures relate to it?
  2. When would you use Factory Functions over Classes?
  3. Explain how Currying and Partial Application work. Real use cases?
  4. How would you implement a simple pub/sub system (event bus) in vanilla JS?
  5. What are higher-order functions and how do you use them to write more declarative code?

🧪 Real-world Code Challenges (You May Be Asked to Solve Live)

  • Implement a debounce function.
  • Write a deep clone function (without structuredClone() or JSON.parse).
  • Create a memoization wrapper for any expensive function.
  • Write a simple compose() or pipe() utility.
  • Implement a once() function that runs a callback only once.

🧠 System Thinking & Architecture

  1. How do you design a large-scale JS codebase to remain modular and maintainable?
  2. How do you handle global state in pure JavaScript without libraries?
  3. How do you secure frontend JavaScript code from tampering or leaking secrets?
  4. How do you organize feature flags or A/B tests in a frontend system?
  5. What are some anti-patterns in large JS projects that you’ve encountered and fixed?

Want to Practice?

I can:

  • Simulate a mock interview
  • Give you coding challenges with test cases
  • Walk you through an open-ended architectural system (like a design doc)

Tags

#InterView

Share

Previous Article
ATM Machine Withdraw Request

Table Of Contents

1
2-Pointer Questions
2
🔥 Core JavaScript (Deep Dive)
3
⚙️ Async Programming
4
📦 Performance and Optimization
5
🔧 Code Design & Patterns
6
🧪 Real-world Code Challenges (You May Be Asked to Solve Live)
7
🧠 System Thinking & Architecture
8
Want to Practice?

Related Posts

Nextjs interview questions
March 01, 2025
2 min
© 2025, All Rights Reserved.
Powered By

Quick Links

About Me

Legal Stuff

Social Media