DEV Community

Vivek Nishant
Vivek Nishant

Posted on • Edited on

JavaScript Interview Questions

Basics

  1. What are the differences between var, let, and const?
  2. Explain the difference between == and === in JavaScript.
  3. What is hoisting in JavaScript?
  4. Explain closures and give an example.
  5. What is the difference between function declaration and function expression?
  6. What is the difference between null and undefined?
  7. What are template literals, and how do you use them?
  8. Explain the difference between synchronous and asynchronous code.
  9. What are arrow functions, and how do they differ from regular functions?
  10. What is the difference between primitive and reference types in JavaScript?

Advanced Topics

  1. What is the event loop in JavaScript?
  2. Explain the concept of Promises in JavaScript.
  3. What are async/await, and how do they work?
  4. Explain callback functions with an example.
  5. What is the difference between shallow and deep copy in JavaScript?
  6. Explain the concept of this in JavaScript.
  7. What are JavaScript Prototypes, and how do they work?
  8. Explain the difference between call(), apply(), and bind().
  9. What is debouncing and throttling? Provide examples.
  10. What is the difference between map(), forEach(), filter(), and reduce()?

DOM & BOM

  1. How do you select elements using JavaScript (e.g., querySelector vs. getElementById)?
  2. What is event delegation, and why is it useful?
  3. How does event bubbling and capturing work in JavaScript?
  4. Explain localStorage, sessionStorage, and cookies.
  5. How do you prevent the default behavior of an event in JavaScript?

ES6+ Features & Best Practices

  1. What are JavaScript modules, and how do you use import and export?
  2. What is destructuring in JavaScript, and how is it used?
  3. What are rest and spread operators in JavaScript?
  4. What is optional chaining (?.) in JavaScript?
  5. Explain the difference between deep equality and shallow equality in JavaScript.

Top comments (0)