JavaScript Interview Questions 2026

Published July 22, 2026 · Updated July 22, 2026

54 JavaScript interview questions from Amazon, Accenture, Capgemini, Google. All difficulty levels, all roles. Upvoted by engineers who were asked them.

54 questions
Companies: Amazon, Accenture, Capgemini, Google
3390 upvotes

JavaScript Questions by Company

Amazon (1)

Amazon Medium Technical round JavaPythonJavaScript

Given an array of integers and a target sum, return all unique triplets that sum to the target. Discuss time and space complexity. Then extend the problem to k-sum and analyze how recursion depth changes performance for large k.

↑ 54 upvotes · 47 engineers asked this · SDE2

Accenture (9)

Accenture Medium Technical round SeleniumPlaywrightJavaScript

What differences do you see between Selenium and Playwright in automation testing? Cover architecture, browser support, speed, built-in waiting mechanisms, and cross-language support.

↑ 61 upvotes · 22 engineers asked this · Developer
Accenture Medium Technical round SeleniumPlaywrightJavaScript

If a team currently using Selenium plans to migrate to Playwright, how would you help them adopt the new framework? Cover project structure, locator migration, parallel execution setup, and CI integration.

↑ 52 upvotes · 15 engineers asked this · Developer
Accenture Medium Technical round JavaJavaScript

When two developers push changes to the same file in Git simultaneously, how would you resolve the merge conflict? Walk through: pulling latest, identifying conflict markers (<<<, ===, >>>), choosing which changes to keep, testing after resolution, and committing the merge.

↑ 53 upvotes · 20 engineers asked this · Developer
Accenture Medium Technical round 8–12 YearsJavaScriptHTMLReact

What is the difference between async and defer attributes in JavaScript? When would you use each one?

↑ 41 upvotes · 28 engineers asked this · Full Stack Developer
Accenture Medium Technical round 8–12 YearsJavaScriptCDNReact

How would you optimize video delivery in a web application to reduce load times and improve user experience?

↑ 33 upvotes · 21 engineers asked this · Full Stack Developer
Accenture Hard Technical round 8–12 YearsReactJavaScriptPerformance

What causes unnecessary re-renders in React, and how can React.memo, useMemo, and useCallback help improve performance?

↑ 78 upvotes · 54 engineers asked this · Full Stack Developer
Accenture Medium Technical round 8–12 YearsHTMLJavaScriptPerformance

What are resource hints such as preload, prefetch, and dns-prefetch? Explain when you would use each of them.

↑ 45 upvotes · 31 engineers asked this · Full Stack Developer
Accenture Medium Technical round 8–12 YearsJavaScriptReactPerformance

How would you optimize the loading of third-party scripts such as analytics, chat widgets, or advertising libraries?

↑ 49 upvotes · 33 engineers asked this · Full Stack Developer
Accenture Hard Technical round 8–12 YearsReactJavaScriptPerformance

A component renders hundreds of items and users experience UI lag. How would you investigate and optimize the rendering performance?

↑ 63 upvotes · 44 engineers asked this · Full Stack Developer

Capgemini (5)

Capgemini Medium Technical round PlaywrightTypeScriptJavaScript

Write Playwright code to handle multiple windows (browser contexts/tabs) and perform actions on a new page. Explain the difference between new page events and popup events, and how to wait for a page load before interacting.

↑ 68 upvotes · 24 engineers asked this · Tester
Capgemini Medium Technical round JavaScriptTypeScriptPlaywright

Explain the filter(), map(), and reduce() array methods in JavaScript with examples. Show how you would use them together to process a list of test results: filtering failures, mapping to error messages, and reducing to a summary count.

↑ 47 upvotes · 17 engineers asked this · Tester
Capgemini Medium Technical round JavaScriptTypeScript

Explain async/await in JavaScript. How does it differ from Promise chaining? Write a function that fetches data from three APIs in parallel (Promise.all) and one after another (sequential await). When would you choose each?

↑ 51 upvotes · 32 engineers asked this · Developer
Capgemini Medium Technical round PlaywrightTypeScriptJavaScript

What is cross-browser testing? How do you run the same Playwright test suite on Chrome, Firefox, and WebKit simultaneously? How do you handle browser-specific issues in your automation code?

↑ 38 upvotes · 22 engineers asked this · Tester
Capgemini Medium Technical round 1-4 yearsJavaScript

Write a function that creates 3 buttons where clicking button N alerts N, using a for loop and var. Explain why the naive version is broken and how to fix it.

↑ 25 upvotes · 18 engineers asked this · Developer

Google (3)

Google Hard Technical round JavaScriptNode.js

Explain how a browser renders a web page from the moment the user presses Enter. Cover: DNS resolution, TCP handshake, HTTP request, HTML parsing, CSSOM, render tree, layout, paint, and compositing. Where would you optimise for Core Web Vitals?

↑ 58 upvotes · 35 engineers asked this · SDE2
Google Medium Scenario round 3–6 YearsReactJavaScript

A list of 50,000 items renders in a React component. Users scroll and experience jank. How do you fix it without pagination?

↑ 109 upvotes · 86 engineers asked this · Full Stack Developer
Google Medium Technical round 3-6 yearsReactJavaScript

Explain the difference between reconciliation and the commit phase in React. Why can render be interrupted in Concurrent Mode but commit cannot?

↑ 38 upvotes · 15 engineers asked this · Senior SDE

Meta (5)

Meta Hard Technical round ReactJavaScript

Explain how React's virtual DOM diffing algorithm (reconciliation) works. Why is it O(n) instead of O(n3)? What are the assumptions it makes and when do those break down (causing performance issues)?

↑ 56 upvotes · 34 engineers asked this · SDE2
Meta Medium Technical round PythonJavaJavaScript

Given an array of N integers, find the maximum product subarray. Explain why you need to track both the maximum and minimum product ending at each position, and handle zeros and negative numbers.

↑ 52 upvotes · 33 engineers asked this · SDE1
Meta Medium Technical round 4–6 YearsReactJavaScript

What is the difference between useMemo and useCallback? Give concrete examples of when each actually helps vs. when it hurts.

↑ 107 upvotes · 84 engineers asked this · Full Stack Developer
Meta Hard Technical round 3-7 yearsReactJavaScript

A news feed component re-fetches and re-renders every item whenever a single like count changes. Walk through how you would restructure state so only the affected item re-renders, without introducing a global state library.

↑ 52 upvotes · 31 engineers asked this · Senior SDE
Meta Medium Technical round 1-4 yearsJavaScript

Explain the output order of this code and why: console.log(1); setTimeout(()=>console.log(2),0); Promise.resolve().then(()=>console.log(3)); console.log(4);

↑ 41 upvotes · 38 engineers asked this · Senior SDE

Paytm (1)

Paytm Hard Technical round JavaScriptReactREST

Explain Paytm's mini-app platform architecture. Third-party developers build apps that run inside the Paytm super-app. How do you sandbox them (security), manage their lifecycle, share user identity safely (OAuth), and handle payments on their behalf?

↑ 45 upvotes · 28 engineers asked this · SDE2

Adobe (3)

Adobe Hard Technical round C++JavaScript

Explain how font rendering works at the operating system level. How does Adobe handle vector-to-raster conversion (hinting, anti-aliasing) for different DPI screens? Why do fonts look different on Windows vs macOS?

↑ 38 upvotes · 22 engineers asked this · SDE2
Adobe Hard Technical round 3-7 yearsReactJavaScript

You're building a browser-based image editor with layers, filters, and undo/redo. Would you manage canvas rendering state inside React state, or outside it? Justify your choice.

↑ 25 upvotes · 8 engineers asked this · Senior SDE
Adobe Medium Technical round 2-6 yearsPerformanceJavaScript

A web-based PDF viewer becomes unresponsive when rendering a 200-page document. What rendering strategy would you use so the app stays responsive?

↑ 21 upvotes · 7 engineers asked this · Senior SDE

PayU (20)

PayU Medium Technical round 2–5 YearsInterview ExperienceJavaScriptJavaPython

Given an array of transaction amounts, find all pairs whose sum equals a given target. Return the count of unique pairs. For example: [100, 200, 300, 400], target = 500 → pairs: (100,400), (200,300) → count: 2. What is the time and space complexity of your approach?

↑ 61 upvotes · 42 engineers asked this · Full Stack Developer
PayU Medium Technical round 2–5 YearsInterview ExperienceJavaScriptJava

You have an array of daily payment failure counts for the past 30 days. Find the longest contiguous subarray where failures stayed below a given threshold k. Explain your sliding window approach and walk through the algorithm step by step.

↑ 48 upvotes · 33 engineers asked this · Full Stack Developer
PayU Medium Technical round 2–5 YearsInterview ExperienceJavaScriptJava

Given a list of payment events, each with a merchant ID and an amount, use a HashMap to return the top 3 merchants by total transaction volume. How would you handle ties? Write the complete solution.

↑ 57 upvotes · 39 engineers asked this · Full Stack Developer
PayU Medium Technical round 2–5 YearsInterview ExperienceJavaScript

Implement a function that detects duplicate transaction IDs within a 5-minute time window. Given an array of {id, timestamp} objects, return all IDs that appear more than once within any 5-minute rolling window. What data structure would you use and why?

↑ 72 upvotes · 51 engineers asked this · Full Stack Developer
PayU Medium Technical round 2–5 YearsInterview ExperienceJavaScriptJavaPython

Given a 2D matrix representing a payment heatmap (rows = hours, columns = days), find the submatrix with the maximum sum. The submatrix represents the peak payment activity window. Describe your approach — can you do better than O(n³)?

↑ 44 upvotes · 29 engineers asked this · Full Stack Developer
PayU Medium Technical round 2–5 YearsInterview ExperienceJavaScript

Design an in-memory rate limiter that allows at most N requests per user per minute. Given a stream of {userId, timestamp} requests, return true if the request should be allowed or false if it should be throttled. Implement using JavaScript.

↑ 83 upvotes · 58 engineers asked this · Full Stack Developer
PayU Medium Technical round 2–5 YearsInterview ExperienceJavaScript

What will the following code output and why? const obj = { x: 10 }; const fn = () => console.log(this.x); obj.fn = fn; obj.fn(); Now rewrite fn as a regular function. How does the output change and what is the reason?

↑ 91 upvotes · 67 engineers asked this · Full Stack Developer
PayU Medium Technical round 2–5 YearsInterview ExperienceJavaScript

Predict the output of this code: console.log(1); setTimeout(() => console.log(2), 0); Promise.resolve().then(() => console.log(3)); console.log(4); Explain the event loop mechanism that determines this order.

↑ 104 upvotes · 78 engineers asked this · Full Stack Developer
PayU Medium Technical round 2–5 YearsInterview ExperienceJavaScriptReact

Implement a debounce function from scratch in JavaScript. Then explain where you would use debounce vs throttle in a payment checkout flow — for example on a search input, a "Pay Now" button, and a scroll event handler.

↑ 88 upvotes · 62 engineers asked this · Full Stack Developer
PayU Medium Technical round 2–5 YearsInterview ExperienceReactJavaScript

Explain the reconciliation algorithm in React. How does React decide which DOM nodes to update when state changes? What is the role of the key prop and what happens when you use an array index as a key versus a stable unique ID?

↑ 96 upvotes · 71 engineers asked this · Full Stack Developer
PayU Medium Technical round 2–5 YearsInterview ExperienceReactJavaScript

Build a custom useFetch hook in React that accepts a URL, returns { data, loading, error }, handles component unmount (cleanup), and prevents state updates on an unmounted component. Show the complete implementation.

↑ 82 upvotes · 59 engineers asked this · Full Stack Developer
PayU Medium Technical round 2–5 YearsInterview ExperienceReactJavaScript

Implement a reusable PaymentForm component in React with fields for card number, expiry, and CVV. Add real-time validation using controlled components: card number must be 16 digits, expiry must be a future month, CVV 3–4 digits. No external libraries.

↑ 74 upvotes · 53 engineers asked this · Full Stack Developer
PayU Medium Technical round 2–5 YearsInterview ExperienceReactJavaScript

You need to implement optimistic UI for a "Add to Cart" button in a React e-commerce app. When the user clicks, the UI should update immediately, but revert if the API call fails. How would you implement this pattern without any state management library?

↑ 79 upvotes · 55 engineers asked this · Full Stack Developer
PayU Hard Technical round 2–5 YearsInterview ExperienceJavaScript

Implement Promise.allSettled from scratch without using the native method. Then explain the difference between Promise.all, Promise.allSettled, Promise.any, and Promise.race — give a concrete payment flow example for when you would use each.

↑ 97 upvotes · 69 engineers asked this · Full Stack Developer
PayU Hard Technical round 2–5 YearsInterview ExperienceJavaScript

A payment API call must retry up to 3 times on network failure, with exponential backoff (1s, 2s, 4s delays) between attempts. Implement a retryWithBackoff(fn, maxRetries) utility using Promises. Handle the case where all retries fail.

↑ 88 upvotes · 63 engineers asked this · Full Stack Developer
PayU Hard System Design round 2–5 YearsInterview ExperienceJavaScriptReactSecurity

Design the frontend architecture for a PayU checkout SDK that can be embedded in any merchant website as a script tag. It must render a payment form in an iframe, handle cross-origin communication, support multiple payment methods (card, UPI, netbanking), and work across React, Vue, and plain HTML merchant sites.

↑ 81 upvotes · 57 engineers asked this · Full Stack Developer
PayU Hard System Design round 2–5 YearsInterview ExperienceReactJavaScript

You are building a multi-step payment flow: Cart → Address → Payment Method → OTP → Confirmation. Each step has its own data, validation, and API calls. How would you architect state management for this flow in React without Redux? Discuss trade-offs.

↑ 85 upvotes · 61 engineers asked this · Full Stack Developer
PayU Hard Technical round 2–5 YearsInterview ExperienceReactJavaScript

Design and implement a recursive category tree component in React for a merchant product catalogue. The tree can be N levels deep, each node can be expanded/collapsed independently, and the selected path must be highlighted. Clicking a leaf node should emit the full path (e.g. "Electronics > Phones > Android"). Optimise to avoid re-rendering siblings when one node is toggled.

↑ 76 upvotes · 54 engineers asked this · Full Stack Developer
PayU Hard Technical round 2–5 YearsInterview ExperienceJavaScriptReactPerformance

A merchant reports that their checkout page built with your SDK scores 38 on Google Lighthouse. Walk through your systematic debugging process: which Core Web Vitals are likely failing, what tools you would use, and give five concrete optimisations specific to a payment checkout flow.

↑ 79 upvotes · 56 engineers asked this · Full Stack Developer
PayU Hard System Design round 2–5 YearsInterview ExperienceJavaScriptReactSystem Design

PayU wants to run A/B tests on the checkout button colour and payment method ordering to improve conversion rates. As the frontend engineer, how would you design the experimentation infrastructure: flag evaluation, consistent user bucketing, avoiding layout shift between variants, and measuring the right success metrics?

↑ 71 upvotes · 49 engineers asked this · Full Stack Developer

Airbnb (2)

Airbnb Hard Scenario round 5–8 YearsReactJavaScript

A React dashboard with 20 charts re-renders every time any filter changes, causing a 3-second lag. How do you optimize it?

↑ 116 upvotes · 91 engineers asked this · Full Stack Developer
Airbnb Medium Technical round 2-5 yearsReactJavaScript

A multi-step booking form (dates → guests → payment) loses all user input if they navigate back a step or refresh the page. How would you fix this without a backend round-trip on every keystroke?

↑ 27 upvotes · 18 engineers asked this · Senior SDE

Shopify (1)

Shopify Hard Scenario round 5–8 YearsReactJavaScriptNext.js

Your React app initial load time is 8 seconds. Users complain it is too slow. Walk me through your optimization strategy.

↑ 124 upvotes · 97 engineers asked this · Full Stack Developer

Microsoft (1)

Microsoft Hard Technical round 4–7 YearsReactJavaScriptNext.js

What is React 19 use() hook and how does it change async data fetching compared to useEffect?

↑ 98 upvotes · 77 engineers asked this · Full Stack Developer

Atlassian (1)

Atlassian Medium Technical round 2-5 yearsJavaScriptReact

A drag-and-drop board with 500+ cards becomes laggy while dragging. What specific JavaScript/DOM techniques would you use to keep the drag interaction smooth?

↑ 22 upvotes · 9 engineers asked this · Senior SDE

Wipro (2)

Wipro Easy Technical round 1-3 yearsReactJavaScript

What is the difference between useState and useRef in React? Give an example where using the wrong one would cause a bug.

↑ 22 upvotes · 14 engineers asked this · Developer
Wipro Medium Technical round 1-4 yearsReactJavaScript

What is a controlled component in React? Rewrite an uncontrolled input (using a ref) into a controlled one and explain the trade-off.

↑ 25 upvotes · 17 engineers asked this · Developer

Practice these questions with AI feedback

Get instant grading on your answers, identify your weak areas, and generate a personalised 14-day study plan — all free.

Build my study plan →

JavaScript questions at each company

Accenture JavaScript Capgemini JavaScript Meta JavaScript PayU JavaScript

Frequently asked questions

Given an array of integers and a target sum, return all unique triplets that sum to the target. Discuss time and space complexity. Then extend the problem to k-sum and analyze how recursion depth changes performance for large k.
Given an array of integers and a target sum, return all unique triplets that sum to the target. Discuss time and space complexity. Then extend the problem to k-sum and analyze how recursion depth changes performance for large k.
What differences do you see between Selenium and Playwright in automation testing? Cover architecture, browser support, speed, built-in waiting mechanisms, and cross-language support.
What differences do you see between Selenium and Playwright in automation testing? Cover architecture, browser support, speed, built-in waiting mechanisms, and cross-language support.
If a team currently using Selenium plans to migrate to Playwright, how would you help them adopt the new framework? Cover project structure, locator migration, parallel execution setup, and CI integration.
If a team currently using Selenium plans to migrate to Playwright, how would you help them adopt the new framework? Cover project structure, locator migration, parallel execution setup, and CI integration.
When two developers push changes to the same file in Git simultaneously, how would you resolve the merge conflict?
When two developers push changes to the same file in Git simultaneously, how would you resolve the merge conflict? Walk through: pulling latest, identifying conflict markers (<<<, ===, >>>), choosing which changes to keep, testing after resolution, and committing the merge.
Write Playwright code to handle multiple windows (browser contexts/tabs) and perform actions on a new page. Explain the difference between new page events and popup events, and how to wait for a page load before interacting.
Write Playwright code to handle multiple windows (browser contexts/tabs) and perform actions on a new page. Explain the difference between new page events and popup events, and how to wait for a page load before interacting.