What Are Common JavaScript Interview Questions

· Category: Tech Career

Short answer

JavaScript interviews test understanding of closures, asynchronous programming, the event loop, prototypal inheritance, and ES6 features.

How it works

  • Closures: Functions retaining access to their lexical scope.
  • Promises/async-await: Managing asynchronous operations.
  • Event loop: How JavaScript handles concurrency with a single thread.
  • this keyword: Context-dependent referencing.
  • Prototypes: Inheritance model in JavaScript.

Example

Explain the output of:

for (var i = 0; i < 3; i++) {
  setTimeout(() => console.log(i), 100);
}

The answer involves var scoping and the event loop.

Why it matters

JavaScript quirks cause real bugs. Interviewers want to see that you understand the language deeply, not just framework APIs.