QA
⚡
Frontend

JavaScript & TypeScript Interview Questions

Deep dive into JavaScript execution contexts, memory leaks, prototypes, alongside advanced TypeScript strict type systems and generics.

🎯 Ready to test your knowledge?

Take JavaScript & TypeScript Skill Assessment Quiz

First prepare from the 100 learning questions below, then test your skills with 15 random MCQs categorized into Beginner, Intermediate, and Senior levels.

Launch 15-MCQ Quiz →
Experience Level:

Showing 100 Questions

Beginner LevelJavaScript & TypeScript

1. What are the differences between var, let, and const in JavaScript?

❓ Context: Compare var, let, and const regarding scope, hoisting, reassignment, and redeclaration.

JavaScript provides three variable declaration keywords with different scoping and mutation rules:

| Feature | var | let | const |

|---|---|---|---|

| Scope | Function-scoped | Block-scoped ({}) | Block-scoped |

| Hoisting | Hoisted (initialized as undefined) | Hoisted (Temporal Dead Zone) | Hoisted (Temporal Dead Zone) |

| Reassignment | ✅ Yes | ✅ Yes | ❌ No |

| Redeclaration | ✅ Yes (same scope) | ❌ No | ❌ No |

Temporal Dead Zone (TDZ):

let and const are hoisted but cannot be accessed before their declaration line. Accessing them throws a ReferenceError.

Best Practice (2026):

Use const by default. Use let only when reassignment is required. Never use var.

javascript
// var is function-scoped (leaks out of blocks)
if (true) { var x = 10; }
console.log(x); // 10 (leaked!)

// let is block-scoped
if (true) { let y = 20; }
// console.log(y); // ReferenceError: y is not defined

// const prevents reassignment
const API_URL = 'https://api.example.com';
// API_URL = 'other'; // TypeError: Assignment to constant

// const objects are mutable (reference is constant, not value)
const user = { name: 'Alice' };
user.name = 'Bob'; // ✅ Allowed (mutating property, not reassigning)
💡Scope leaking with var, block scoping with let/const, and const object mutation.
🎯 Interview Key Takeaway

Use const by default, let when reassignment is needed. Never use var in modern JavaScript.

#Variables#Scope#Hoisting#Beginner
Permalink
Beginner LevelJavaScript & TypeScript

2. What are the JavaScript data types and the difference between primitives and objects?

Beginner LevelJavaScript & TypeScript

3. What is the difference between == (loose equality) and === (strict equality)?

Beginner LevelJavaScript & TypeScript

4. What are the differences between function declarations, expressions, and arrow functions?

Beginner LevelJavaScript & TypeScript

5. How do template literals and string interpolation work in JavaScript?

Beginner LevelJavaScript & TypeScript

6. How does destructuring assignment work for objects and arrays in JavaScript?

Beginner LevelJavaScript & TypeScript

7. What are rest parameters and the spread operator in JavaScript?

Beginner LevelJavaScript & TypeScript

8. How do default parameter values work in JavaScript functions?

Beginner LevelJavaScript & TypeScript

9. What are truthy and falsy values in JavaScript?

Beginner LevelJavaScript & TypeScript

10. How do short-circuit evaluation and logical operators (&&, ||, ??) work?

Beginner LevelJavaScript & TypeScript

11. What is the optional chaining operator (?.) and how does it prevent errors?

Beginner LevelJavaScript & TypeScript

12. What is the nullish coalescing operator (??) vs Logical OR (||)?

Beginner LevelJavaScript & TypeScript

13. What are common array iteration methods (map, filter, reduce, forEach, find)?

Beginner LevelJavaScript & TypeScript

14. What is the difference between Array.prototype.slice() and Array.prototype.splice()?

Beginner LevelJavaScript & TypeScript

15. How do JavaScript Object static methods (keys, values, entries, freeze, seal) work?

Beginner LevelJavaScript & TypeScript

16. What is hoisting in JavaScript and how does it affect functions and variables?

Beginner LevelJavaScript & TypeScript

17. What is scope in JavaScript (global, function, block, and lexical scope)?

Beginner LevelJavaScript & TypeScript

18. What is the basic syntax and purpose of JavaScript Promises?

Beginner LevelJavaScript & TypeScript

19. How does async/await work for handling asynchronous JavaScript code?

Beginner LevelJavaScript & TypeScript

20. What is JSON and how do JSON.stringify() and JSON.parse() work?

Beginner LevelJavaScript & TypeScript

21. What is the difference between primitive values passed by value and objects passed by reference?

Beginner LevelJavaScript & TypeScript

22. How do JavaScript ES6 classes work (constructor, methods, extends, super)?

Beginner LevelJavaScript & TypeScript

23. What is the typeof operator and how do you reliably check data types in JavaScript?

Beginner LevelJavaScript & TypeScript

24. What is NaN, how is it checked, and why does NaN !== NaN?

Beginner LevelJavaScript & TypeScript

25. What are JavaScript Set and Map objects and how do they differ from Arrays and Objects?

Beginner LevelJavaScript & TypeScript

26. How do setTimeout and setInterval work and how do you clear them?

Beginner LevelJavaScript & TypeScript

27. What is TypeScript and how does static typing differ from dynamic typing?

Beginner LevelJavaScript & TypeScript

28. What are basic TypeScript types (primitive, tuple, enum, any, unknown, void, never)?

Beginner LevelJavaScript & TypeScript

29. What is the difference between type aliases and interfaces in TypeScript?

Beginner LevelJavaScript & TypeScript

30. What are TypeScript type assertions (as, angle brackets) and non-null assertion operator (!)?

Intermediate LevelJavaScript & TypeScript

31. What are closures in JavaScript and how do they capture variables?

Intermediate LevelJavaScript & TypeScript

32. Explain the JavaScript Event Loop, microtasks, and macrotasks.

Intermediate LevelJavaScript & TypeScript

33. How does the this keyword work in JavaScript in different contexts?

Intermediate LevelJavaScript & TypeScript

34. What are call(), apply(), and bind() and how do they change function execution context?

Intermediate LevelJavaScript & TypeScript

35. How do Promise.all(), Promise.race(), Promise.allSettled(), and Promise.any() work?

Intermediate LevelJavaScript & TypeScript

36. What is debouncing vs throttling for performance optimization?

Intermediate LevelJavaScript & TypeScript

37. How do WeakMap, WeakSet, and WeakRef prevent memory leaks?

Intermediate LevelJavaScript & TypeScript

38. What is JavaScript prototype inheritance and the prototype chain?

Intermediate LevelJavaScript & TypeScript

39. How do JavaScript Generators (function*) and Iterators work (Symbol.iterator)?

Intermediate LevelJavaScript & TypeScript

40. What is Event Bubbling, Event Capturing, and Event Delegation in JavaScript?

Intermediate LevelJavaScript & TypeScript

41. What are JavaScript ES6 Modules (import/export, default vs named, dynamic imports)?

Intermediate LevelJavaScript & TypeScript

42. How does deep cloning vs shallow cloning work in JavaScript (structuredClone, spread, JSON)?

Intermediate LevelJavaScript & TypeScript

43. What is the difference between Symbol and string keys in JavaScript objects?

Intermediate LevelJavaScript & TypeScript

44. How do JavaScript Proxy and Reflect API enable meta-programming and object interception?

Intermediate LevelJavaScript & TypeScript

45. What is the Temporal Dead Zone (TDZ) in detail and how does the JS engine handle declarations?

Intermediate LevelJavaScript & TypeScript

46. How do async generators and for await...of loops work in JavaScript?

Intermediate LevelJavaScript & TypeScript

47. What is the Web API vs JavaScript runtime engine (V8, JavaScriptCore)?

Intermediate LevelJavaScript & TypeScript

48. How does error handling work in async JavaScript (try/catch, Promise .catch, global unhandledrejection)?

Intermediate LevelJavaScript & TypeScript

49. What are JavaScript getters and setters in objects and classes?

Intermediate LevelJavaScript & TypeScript

50. How does JavaScript handle decimal precision issues (0.1 + 0.2 !== 0.3) and BigInt?

Intermediate LevelJavaScript & TypeScript

51. What are TypeScript Union and Intersection types and how do type guards work?

Intermediate LevelJavaScript & TypeScript

52. How do TypeScript generics work in functions, interfaces, and classes?

Intermediate LevelJavaScript & TypeScript

53. What is TypeScript strict mode and what compiler flags are essential?

Intermediate LevelJavaScript & TypeScript

54. What are TypeScript utility types (Partial, Required, Readonly, Record, Pick, Omit, Exclude, Extract)?

Intermediate LevelJavaScript & TypeScript

55. What are TypeScript Enums (numeric vs string vs const enums) and why prefer union types?

Intermediate LevelJavaScript & TypeScript

56. How do TypeScript custom Type Guards (is keyword) and Assertion Functions work?

Intermediate LevelJavaScript & TypeScript

57. What is index signature and record type in TypeScript?

Intermediate LevelJavaScript & TypeScript

58. How does declaration merging work in TypeScript interfaces?

Intermediate LevelJavaScript & TypeScript

59. What are keyof and typeof type operators in TypeScript?

Intermediate LevelJavaScript & TypeScript

60. How do conditional types (T extends U ? X : Y) work in TypeScript?

Intermediate LevelJavaScript & TypeScript

61. What is template literal types in TypeScript?

Intermediate LevelJavaScript & TypeScript

62. What is the infer keyword in TypeScript conditional types?

Intermediate LevelJavaScript & TypeScript

63. What are indexed access types (T[K]) in TypeScript?

Intermediate LevelJavaScript & TypeScript

64. How does satisfies operator work in TypeScript 4.9+?

Intermediate LevelJavaScript & TypeScript

65. What are mapped types with key remapping in TypeScript (as clause in mapped types)?

Intermediate LevelJavaScript & TypeScript

66. How do private class fields (#field) in ES2022 differ from TypeScript private access modifiers?

Intermediate LevelJavaScript & TypeScript

67. What is the override keyword and abstract classes in TypeScript?

Intermediate LevelJavaScript & TypeScript

68. How does module resolution (NodeNext, Bundler) work in TypeScript configuration?

Intermediate LevelJavaScript & TypeScript

69. What are Ambient Declarations (.d.ts) and declare global in TypeScript?

Intermediate LevelJavaScript & TypeScript

70. What are Type Narrowing strategies in TypeScript (in, instanceof, typeof, equality, discriminated unions)?

Senior LevelJavaScript & TypeScript

71. What are common JavaScript memory leaks and how do you detect them?

Senior LevelJavaScript & TypeScript

72. How do TypeScript generics, conditional types, and mapped types work?

Senior LevelJavaScript & TypeScript

73. What are TypeScript discriminated unions and exhaustive type checks?

Senior LevelJavaScript & TypeScript

74. How does JavaScript garbage collection work (mark-and-sweep, generational GC)?

Senior LevelJavaScript & TypeScript

75. What is the V8 engine compilation pipeline (Ignition, TurboFan, hidden classes)?

Senior LevelJavaScript & TypeScript

76. How do Web Workers and SharedArrayBuffer enable multi-threaded parallel execution in JavaScript?

Senior LevelJavaScript & TypeScript

77. What is the TC39 proposal process and how do Babel/SWC polyfill modern JS features?

Senior LevelJavaScript & TypeScript

78. How do JavaScript decorators (Stage 3 proposal / TS experimental) work?

Senior LevelJavaScript & TypeScript

79. How to design type-safe builder patterns and fluent APIs in TypeScript?

Senior LevelJavaScript & TypeScript

80. What is branded types / nominal typing in TypeScript and how does it prevent type confusion?

Senior LevelJavaScript & TypeScript

81. How do Recursive Conditional Types work in TypeScript (e.g. JSONValue, DeepReadonly)?

Senior LevelJavaScript & TypeScript

82. How to build a custom type-safe Event Emitter / PubSub system in TypeScript?

Senior LevelJavaScript & TypeScript

83. What are ESM vs CommonJS interop issues and tree-shaking optimization strategies?

Senior LevelJavaScript & TypeScript

84. How do JavaScript execution contexts, lexical environments, and variable environments work under the hood?

Senior LevelJavaScript & TypeScript

85. How does the Shadow Realm API and isolated JavaScript execution sandboxes work?

Senior LevelJavaScript & TypeScript

86. How do you implement robust memoization and cache eviction strategies (LRU cache) in JS/TS?

Senior LevelJavaScript & TypeScript

87. What are TypeScript variadic tuple types and tuple manipulation?

Senior LevelJavaScript & TypeScript

88. How do micro-optimizations (hidden classes, deoptimizations, monomorphic calls) affect V8 performance?

Senior LevelJavaScript & TypeScript

89. How does TypeScript's type checker engine perform type inference and control flow analysis?

Senior LevelJavaScript & TypeScript

90. How do you implement custom async retry logic with exponential backoff and jitter in TypeScript?

Senior LevelJavaScript & TypeScript

91. What is top-level await, dynamic import(), and code splitting in modern JS/TS applications?

Senior LevelJavaScript & TypeScript

92. How does AbortController and AbortSignal work for canceling fetch requests and async tasks?

Senior LevelJavaScript & TypeScript

93. How to write type-safe API clients using generic fetch wrappers and zod schema validation?

Senior LevelJavaScript & TypeScript

94. What are JavaScript Streams API (ReadableStream, WritableStream) and backpressure handling?

Senior LevelJavaScript & TypeScript

95. How to construct domain-specific languages (DSL) or AST parsers in JavaScript/TypeScript?

Senior LevelJavaScript & TypeScript

96. What are JavaScript Atomics, SharedArrayBuffer, and mutex locks for shared memory concurrency?

Senior LevelJavaScript & TypeScript

97. How does TypeScript project references (tsconfig.json references + composite) optimize monorepo build performance?

Senior LevelJavaScript & TypeScript

98. How to implement custom immutability utilities or structural sharing (similar to Immer) in JS/TS?

Senior LevelJavaScript & TypeScript

99. How do WebAssembly (Wasm) modules interface with JavaScript memory and typed arrays?

Senior LevelJavaScript & TypeScript

100. How do you design an enterprise-grade TypeScript application architecture with strict type safety and performance?

How to Prepare for JavaScript & TypeScript Technical Interviews in 2026

When interviewing for software engineering positions that utilize JavaScript & TypeScript, hiring managers look for a combination of fundamental syntax proficiency, architectural understanding, code optimization techniques, and practical debugging skills.

🌱 Beginner FocusCore syntax, default configurations, standard API definitions, and avoiding common basic errors.
⚡ Intermediate FocusAsync execution patterns, performance profiling, component lifecycle, and state management.
🏆 Senior FocusInternal runtime mechanics, memory leaks, scalability bottlenecks, system design trade-offs, and security mitigation.