InterviewQs

JavaScript Interview Questions

Top 50 high-demand JavaScript interview questions with modern, industry-focused answers.

Start Learning

Top 50 JavaScript Interview Questions

Frequently asked in frontend, backend, and full-stack interviews.

1. What is JavaScript?

JavaScript is a high-level, interpreted scripting language used to create dynamic and interactive web applications.

2. Is JavaScript compiled or interpreted?

JavaScript is interpreted, but modern engines use Just-In-Time (JIT) compilation for performance.

3. What are the data types in JavaScript?

Primitive: string, number, boolean, null, undefined, symbol, bigint. Non-primitive: object, array, function.

4. Difference between var, let, and const?

var is function-scoped, let and const are block-scoped; const cannot be reassigned.

5. What is hoisting?

Hoisting moves variable and function declarations to the top of their scope during compilation.

6. What is closure?

A closure allows a function to access variables from its outer scope even after the outer function has finished.

7. What is scope?

Scope defines the accessibility of variables (global, function, block).

8. What is this keyword?

this refers to the object that is executing the current function.

9. What is an arrow function?

A shorter syntax for functions that does not bind its own this.

10. What is event bubbling?

Events propagate from the target element up to parent elements.

11. What is event capturing?

Events propagate from parent elements down to the target.

12. What is event delegation?

Handling events using a parent element instead of individual child elements.

13. What is DOM?

Document Object Model represents the HTML structure as objects.

14. What is BOM?

Browser Object Model provides access to browser features like window and navigator.

15. What is callback function?

A function passed as an argument and executed later.

16. What is promise?

An object representing the eventual completion or failure of an asynchronous operation.

17. What is async/await?

A cleaner syntax for handling promises and asynchronous code.

18. What is synchronous vs asynchronous?

Synchronous blocks execution; asynchronous allows non-blocking execution.

19. What is setTimeout?

Executes code after a specified delay.

20. What is setInterval?

Executes code repeatedly at fixed time intervals.

21. What is JSON?

A lightweight data-exchange format using key-value pairs.

22. What is localStorage?

Stores data in the browser with no expiration.

23. What is sessionStorage?

Stores data for a single browser session.

24. What is cookie?

Small data stored in the browser and sent with HTTP requests.

25. Difference between == and ===?

== compares values; === compares value and type.

26. What is NaN?

Represents “Not a Number”.

27. What is prototype?

Mechanism through which JavaScript objects inherit properties.

28. What is prototype chain?

Series of linked prototypes used for property lookup.

29. What is destructuring?

Extracting values from arrays or objects into variables.

30. What is spread operator?

Expands iterable elements into individual values.

31. What is rest operator?

Collects remaining elements into an array.

32. What is map()?

Creates a new array by applying a function to each element.

33. What is filter()?

Creates a new array with elements that pass a condition.

34. What is reduce()?

Reduces an array to a single value.

35. What is IIFE?

Immediately Invoked Function Expression executes immediately after definition.

36. What is strict mode?

Enforces stricter parsing and error handling in JavaScript.

37. What is debounce?

Limits function execution until after a delay.

38. What is throttle?

Ensures function runs at most once in a given time period.

39. What is single-threaded nature of JS?

JavaScript executes one task at a time but handles async via event loop.

40. What is event loop?

Handles asynchronous callbacks and task execution.

41. What is call stack?

Tracks function execution order.

42. What is memory leak?

Unused memory not released by the program.

43. What is shallow copy?

Copies references, not nested objects.

44. What is deep copy?

Creates completely independent copy of objects.

45. What is module?

Reusable piece of code exported and imported across files.

46. What is ES6?

Modern JavaScript version introducing classes, arrow functions, let/const.

47. What is Node.js?

JavaScript runtime built on Chrome’s V8 engine for server-side development.

48. What is npm?

Node Package Manager used to manage JavaScript packages.

49. What is framework vs library?

Framework controls flow; library is used when needed.

50. JavaScript vs TypeScript?

TypeScript adds static typing and better tooling to JavaScript.

Ace Your JavaScript Interviews

Save this page for last-minute JavaScript revision.