JS Guide
HomeQuestionsTopicsCompaniesResources
BookmarksSearch

Built for developers preparing for JavaScript, React & TypeScript interviews.

ResourcesQuestionsSupport
HomeQuestionsSearchProgress
HomeQuestionsjavascript

javascript

Core JavaScript concepts, ES6+, and language fundamentals

Explore 29 javascript topics to deepen your understanding

Your Progress

0 of 13 completed

0%

13 Questions

senior Level
1
Explain JavaScript's prototype chain and how inheritance works.
senior
prototypes
JavaScript uses prototypal inheritance where objects inherit directly from other objects through a prototype chain. Each object has an internal [[Prototype]] link that forms a chain used for property lookup until null is reached.
2
What are Generators in JavaScript and when would you use them?
senior
generators
Generators are functions that can pause execution and resume later, yielding multiple values over time. They're defined with function* syntax and return an iterator. Use cases include lazy evaluation, infinite sequences, and custom iterables.
3
What are Proxies in JavaScript and how can they be used?
senior
metaprogramming
A Proxy wraps an object and intercepts fundamental operations (get, set, delete, etc.) through handler traps. They enable metaprogramming patterns like validation, logging, lazy loading, and implementing reactive systems.
4
How does JavaScript garbage collection work and how can you prevent memory leaks?
senior
memory
JavaScript uses automatic garbage collection with a mark-and-sweep algorithm. Objects are collected when unreachable from roots (global, stack). Memory leaks occur from uncleared references like closures, event listeners, intervals, and DOM references.
5
Explain the Module pattern and how ES6 modules differ from CommonJS.
senior
modules
The Module pattern encapsulates code using closures to create private state. ES6 modules are the standard with static imports (analyzed at compile time), while CommonJS uses dynamic require() at runtime. ES6 supports tree-shaking and async loading.
6
What is CORS, when do CORS errors occur, and how can they be resolved?
senior
cors
CORS (Cross-Origin Resource Sharing) is a browser security mechanism that blocks cross-origin requests unless the server explicitly allows them via HTTP headers like Access-Control-Allow-Origin.
7
How would you implement a debounce function from scratch with advanced features?
senior
debounce-throttle
A debounce function delays execution until a pause in calls, using a closure to manage a timer that resets on each invocation. Advanced implementations support leading/trailing edge execution, cancel and flush methods, and a maxWait option to guarantee eventual execution.
8
How would you implement a simplified Promise from scratch?
senior
promise-impl
A Promise implementation requires managing three states (pending/fulfilled/rejected), storing callbacks via then(), executing them asynchronously when the state transitions, and supporting chaining by returning new Promises from then().
9
What is requestIdleCallback and how does it compare to other scheduling APIs?
senior
scheduling
requestIdleCallback schedules low-priority work to run during idle periods when the browser's main thread has no other tasks. Unlike requestAnimationFrame (which runs before every repaint) or setTimeout (which has a minimum delay), it runs only when the browser is truly idle.
10
How do WebSockets work and when would you use them over HTTP?
senior
runtime
WebSockets provide full-duplex, persistent communication between client and server over a single TCP connection. They start as an HTTP upgrade handshake, then switch to a lightweight binary-framed protocol. Use them for real-time features like chat, live notifications, collaborative editing, and live order tracking.
11
How would you implement Function.prototype.bind from scratch?
senior
this
A bind polyfill returns a new function that calls the original with a fixed `this` context and optionally prepended arguments. The implementation must handle partial application, preserve the prototype chain when used with `new`, and forward all arguments correctly.
12
How would you implement JSON.stringify from scratch?
senior
json
A JSON.stringify polyfill recursively converts JavaScript values to JSON strings by handling each type differently: strings get quoted, numbers and booleans become literals, arrays and objects are recursively stringified, and special values like undefined, functions, and Symbols are either omitted or converted to null.
13
How would you implement Promise.all and Promise.race from scratch?
senior
async
Promise.all takes an iterable of promises and returns a single promise that resolves with an array of all results (preserving order) or rejects with the first rejection. Promise.race returns a promise that settles with the first promise to settle, whether fulfilled or rejected.