Posted On November 24, 2025

100 JavaScript Interview Questions & Answers

patil.sandip2490@gmail.com 0 comments
>> Uncategorized >> 100 JavaScript Interview Questions & Answers

 

1. What is JavaScript?

JavaScript is a scripting language used to create dynamic, interactive web applications.

2. Is JavaScript single-threaded?

Yes, JavaScript is single-threaded and uses an event-loop mechanism.

3. What is the DOM?

DOM = Document Object Model, a structured representation of HTML.

4. What is Hoisting?

Variables and function declarations are moved to the top of their scope during compilation.

5. What is the difference between var, let, and const?

  • var: function scope

  • let: block scope

  • const: block scope + cannot reassign

6. What is this in JavaScript?

Refers to the object that is currently executing the function.

7. What are Arrow Functions?

Short syntax functions that do not have their own this.

8. Difference between == and ===?

  • == → compares value

  • === → compares value + type

9. What is a Callback Function?

A function passed as an argument to another function.

10. What is a Promise?

Object that represents eventual completion of an asynchronous operation.

11. What is Async/Await?

Syntactic sugar for handling promises.

12. What is Closure?

Inner function remembers variables from outer function even after it executes.

13. What is Event Loop?

Mechanism that handles async tasks and moves them to call stack.

14. What is Event Bubbling?

Event moves from child → parent.

15. Event Capturing?

Event moves from parent → child.

16. What is the difference between null and undefined?

  • undefined: declared but not assigned

  • null: intentionally assigned empty value

17. What is a Higher Order Function?

A function that takes another function or returns a function.

18. What is a Pure Function?

Same input → same output, no side effects.

19. What are Template Literals?

Strings using backticks:

`Hello ${name}`

20. What is an Immediately Invoked Function Expression (IIFE)?

Function that executes immediately.

(function(){})();

21. What is Strict Mode?

A mode that catches more errors.

“use strict”;

22. What is a Prototype?

Every JS object has a prototype → used for inheritance.

23. What is Prototypal Inheritance?

Objects inherit properties from other objects.

24. What is the map() method?

Returns a new array by transforming each element.

25. What is the filter() method?

Returns a new array with elements that match a condition.

26. What is reduce()?

Reduces array to a single value.

27. What is forEach()?

Iterates over array elements but does not return a new array.

28. What is NaN?

Not-a-Number value.

29. How to check if a value is NaN?

isNaN(value)

30. What is the difference between slice() and splice()?

  • slice: returns new array

  • splice: modifies original array

31. What is JSON?

JavaScript Object Notation (data format).

32. What is localStorage?

Stores data permanently in browser.

33. What is sessionStorage?

Stores data until browser tab is closed.

34. What is setTimeout()?

Executes function after delay.

35. What is setInterval()?

Executes function repeatedly at fixed intervals.

36. What is Debouncing?

Executes function after a pause in events.

37. What is Throttling?

Executes function at fixed time intervals.

38. What is the spread operator?

Expands array/object:

…array

39. What is the rest operator?

Combines multiple arguments into array:

function fn(…args){}

40. What is destructuring?

Extracting values from objects/arrays.

41. What is a generator function?

Function that can pause execution (function*).

42. What is the use of yield?

Used in generator functions to return values.

43. What is a Symbol?

Unique and immutable primitive value.

44. What are JS data types?

String, Number, Boolean, Null, Undefined, Object, Symbol, BigInt.

45. What is an array?

List-like object for storing multiple values.

46. What is a function expression?

Function assigned to a variable.

47. What is a function declaration?

function test(){}

48. What is bind()?

Creates a new function with fixed this.

49. What is call()?

Calls a function with specified this.

50. What is apply()?

Same as call() but accepts array of arguments.

51. What is event delegation?

Handling events at parent instead of child.

52. What is typeof?

Used to check type of value.

53. What are default parameters?

function test(a=10){}

54. What is the difference between object and Map?

Map allows any type of key; object uses strings/Symbols.

55. What is a Set?

Stores unique values.

56. What is WeakMap?

Map where keys are weakly referenced objects.

57. What is WeakSet?

Set of weakly referenced objects.

58. Difference between synchronous & asynchronous?

  • Sync → blocks execution

  • Async → does not block execution

59. What is a Web API?

Browser-provided APIs like fetch(), setTimeout().

60. What is CORS?

Cross-origin resource sharing – allows restricted resources.

61. What is event.preventDefault()?

Stops default behavior of event.

62. What is event.stopPropagation()?

Stops further event propagation.

63. What is a shallow copy?

Copies only top-level values.

64. Deep copy?

Copies nested values also:

JSON.parse(JSON.stringify(obj))

65. What is memoization?

Caching function results for better performance.

66. What is a module?

Reusable code unit.

export / import

67. What is CommonJS?

Node.js module system (require()).

68. What is ES6?

JavaScript version adding classes, let, const, arrow functions.

69. What is a polyfill?

Code that implements features in older browsers.

70. What is transpiling?

Converting modern JS → older JS (Babel).

71. What is Babel?

Transpiler that converts ES6+ to ES5.

72. What is Webpack?

Bundler that bundles JS, CSS, images.

73. What is the global object?

  • Browser: window

  • Node: global

74. What is instanceof?

Checks if object belongs to a class.

75. What is a constructor?

Special method used to create object instances.

76. What is new keyword?

Creates a new object instance.

77. What is a class?

Template for creating objects.

78. What is inheritance?

One class extends another.

79. What is encapsulation?

Hiding internal details.

80. What is polymorphism?

Same function name, different behaviors.

81. What is recursion?

Function calling itself.

82. What is tail recursion?

Recursive call is last operation in function.

83. What is a promise chain?

Multiple .then() chained together.

84. What is fetch()?

API for HTTP requests.

85. What is AJAX?

Asynchronous JavaScript and XML – used for server calls.

86. What are cookies?

Small data stored in browser.

87. What is Math.random()?

Generates random number between 0–1.

88. What is Math.floor()?

Rounds down number.

89. What is a RegExp?

Regular expression for pattern matching.

90. What is a promise rejection?

When a promise fails → reject().

91. What is try/catch?

Error handling mechanism.

92. What is destructuring assignment?

Extract values easily:

const {name} = user;

93. What is optional chaining?

user?.address?.street

94. What is the nullish coalescing operator?

value ?? defaultValue

95. What is a ternary operator?

Short if/else:

age > 18 ? “Adult” : “Minor”

96. What is DOM manipulation?

Changing HTML elements using JS.

97. What is innerHTML?

Used to set HTML content of an element.

98. What is async iterator?

Iterator that returns promises.

99. What is a microtask?

Promise callbacks run in microtask queue.

100. What is the call stack?

Data structure that stores function execution order.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

100 HTML Interview Questions & Answers

  1. What is HTML? HTML = HyperText Markup Language for creating web pages. 2.…

PHP Basics Interview Questions and Answers (4 Years Experience)

1) What is PHP?PHP (Hypertext Preprocessor) is a server-side scripting language designed for web development…

Abacus Questions with Answers for LKG Students

1. Number Recognition (0–10)What number is this? 0Answer: ZeroWhat number comes after 2?Answer: 3What number…