Skip to content
Resume Studioby M2Toolkit

22 role-specific questions

Vue.js Developer Interview Questions & Answers

Vue interviews test your understanding of the reactivity system, the Composition API and composables, component communication, state with Pinia, and performance — plus Nuxt for server rendering.

Free, no sign-up. 95 questions in this role's practice pool, including behavioural, HR and situational questions.

Vue.js interview questions

Reactivity, the Composition API, components, Pinia and Nuxt — what Vue interviews focus on.

  1. 1.

    How does Vue's reactivity system work?

    IntermediateTechnical

    What the interviewer is evaluating

    Understanding what triggers updates, which explains most Vue bugs.

    Key points a strong answer covers

    • Proxies. Vue 3 wraps state in Proxies that intercept reads and writes.
    • Dependency tracking. Reads during rendering or a computed are tracked as dependencies.
    • Triggering updates. Writes trigger the effects that depend on that property, then the component re-renders.
    • ref vs reactive. ref wraps a value (accessed via .value); reactive makes an object reactive.
    • Pitfall. Destructuring a reactive object loses reactivity — use toRefs.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Destructuring props or reactive objects and losing reactivity.
    • Not knowing updates are batched asynchronously (nextTick).

    Likely follow-up questions

    • Why do you need .value with refs in script but not in templates?
    • When do you need nextTick?
    Example strong answer

    Vue 3 makes state reactive with JavaScript Proxies. When a component renders, or a computed or watcher runs, every reactive property it reads is tracked as a dependency. When you write to one of those properties, the Proxy's setter triggers the effects that depend on it, and Vue schedules a re-render — batched, so several changes in the same tick cause one update, which is why nextTick exists. ref holds a single value accessed with .value in script (templates unwrap it automatically); reactive makes a whole object reactive. A common pitfall is destructuring a reactive object, which gives plain values that no longer update — toRefs fixes that.

    Practise this question and get feedback
  2. 2.

    Compare the Options API and the Composition API.

    BeginnerTechnical

    What the interviewer is evaluating

    Familiarity with modern Vue and code organisation.

    Key points a strong answer covers

    • Options API structure. The Options API groups code by option type: data, methods, computed.
    • Composition API by feature. The Composition API groups code by feature inside setup / <script setup>.
    • Reuse via composables. Composables replace mixins for reusing logic, without naming clashes.
    • TypeScript. Better TypeScript inference with the Composition API.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Saying the Options API is deprecated.
    • Not mentioning composables.

    Likely follow-up questions

    • What problems did mixins have that composables fix?
    • What does <script setup> compile to?
    Example strong answer

    The Options API organises a component by option type — data, computed, methods, lifecycle hooks — which is easy to learn, but one feature ends up spread across several sections in a big component. The Composition API, usually via <script setup>, organises code by feature: the refs, computed values and functions for search sit together. Its main win is reuse through composables like useFetch or usePagination, which replace mixins without their naming clashes and unclear origins, and it has much better TypeScript inference. The Options API is still supported; for new projects I use <script setup> with TypeScript.

    Practise this question and get feedback
  3. 3.

    When would you use computed properties versus watchers?

    BeginnerTechnical

    What the interviewer is evaluating

    Choosing derived state vs side effects correctly.

    Key points a strong answer covers

    • computed derives values. Computed properties derive a value from reactive state.
    • cached. Computed values are cached until a dependency changes.
    • watch for side effects. Watchers run side effects in response to changes — API calls, localStorage.
    • watchEffect. watchEffect tracks automatically; watch gives old and new values and options like immediate.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Using a watcher to keep one piece of state in sync with another.
    • Putting side effects inside a computed.

    Likely follow-up questions

    • Why must computed getters be free of side effects?
    • When would you use deep: true?
    Example strong answer

    A computed property derives a value from other reactive state — a filtered list, a full name, a cart total — and it's cached, recalculating only when its dependencies change. A watcher is for side effects in response to a change: fetching results when the search query changes, saving to localStorage, or triggering an animation. If I catch myself writing a watcher that sets another piece of state, it should almost always be a computed instead. watch gives the old and new values plus options like immediate and deep; watchEffect tracks whatever it reads automatically, which is convenient but less explicit.

    Practise this question and get feedback
  4. 4.

    How do Vue components communicate with each other?

    BeginnerTechnical

    What the interviewer is evaluating

    Data flow fundamentals.

    Key points a strong answer covers

    • Props down. Parents pass data to children through props.
    • Events up. Children emit events to notify parents.
    • v-model. v-model is sugar for a prop plus an update event.
    • provide/inject. provide/inject passes data to deep descendants.
    • Shared store. Pinia (or a shared composable) for app-wide state.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Mutating props directly in the child.
    • Using a global event bus everywhere.

    Likely follow-up questions

    • Why shouldn't a child mutate a prop?
    • How does defineModel simplify v-model?
    Example strong answer

    Data flows down through props and changes flow up through events: a child receives items as a prop and emits select when the user clicks one, and the parent updates its state. Children never mutate props — that breaks one-way data flow and Vue warns about it. v-model on a component is shorthand for a modelValue prop plus an update:modelValue event, and defineModel makes that a one-liner. For data needed by deeply nested components, like a theme or form context, provide and inject avoid prop drilling. For state shared across the app — the user, the cart — I use a Pinia store.

    Practise this question and get feedback
  5. 5.

    What is Pinia, and how does it compare with Vuex?

    IntermediateTechnical

    What the interviewer is evaluating

    State management in modern Vue apps.

    Key points a strong answer covers

    • Official store. Pinia is the official, recommended store for Vue 3, succeeding Vuex.
    • Simpler API. State, getters and actions — no separate mutations.
    • TypeScript / devtools. Excellent TypeScript inference and devtools support.
    • Modular stores. Multiple small stores defined with defineStore.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Putting all state in a store by default.
    • Destructuring store state without storeToRefs.

    Likely follow-up questions

    • Why do you need storeToRefs when destructuring?
    • How would you persist a Pinia store?
    Example strong answer

    Pinia is the official state management library for Vue 3 and the successor to Vuex. A store is defined with defineStore and has state, getters and actions — there are no separate mutations, so actions can change state directly, synchronously or asynchronously, which removes a lot of Vuex boilerplate. You create several small stores per feature instead of one big module tree, and TypeScript inference works without extra typing. It integrates with Vue DevTools for time-travel inspection. When reading state in a component, I use storeToRefs to destructure without losing reactivity. I only put genuinely shared state in a store; local UI state stays in components.

    Practise this question and get feedback
  6. 6.

    Walk through a Vue component's lifecycle hooks and when you'd use them.

    BeginnerTechnical

    What the interviewer is evaluating

    Knowing where to put setup and cleanup logic.

    Key points a strong answer covers

    • setup / created. setup runs first — state and computed are created here.
    • onMounted. onMounted runs after the DOM exists — measuring, third-party widgets.
    • onUpdated. onUpdated runs after a re-render (use sparingly).
    • onUnmounted cleanup. Clean up timers, listeners and subscriptions in onUnmounted.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Accessing DOM refs in setup before mount.
    • Forgetting to clean up listeners.

    Likely follow-up questions

    • Where would you fetch data in a Vue 3 component?
    • What runs on the server during SSR?
    Example strong answer

    With the Composition API, setup (or <script setup>) runs first and replaces beforeCreate and created — that's where I create state, computed values and start a data fetch. onMounted runs after the component's DOM is in the page, so it's where I measure elements, focus an input or initialise a third-party library like a chart. onUpdated runs after re-renders; I rarely need it. onBeforeUnmount and onUnmounted are for cleanup: removing event listeners, clearing intervals and destroying that chart instance, otherwise they leak. During SSR only setup runs on the server — mounted hooks run in the browser.

    Practise this question and get feedback
  7. 7.

    How would you improve the performance of a large Vue application?

    AdvancedTechnical

    What the interviewer is evaluating

    Measured optimisation in Vue specifically.

    Key points a strong answer covers

    • Measure. Profile with Vue DevTools and the Performance panel first.
    • Lazy loading. Lazy-load routes and heavy components.
    • Rendering cost. Choose v-if vs v-show well, use computed caching, shallowRef for big data, v-memo for heavy lists.
    • Large lists. Virtualise long lists.
    • Stable props. Pass stable props so children don't update unnecessarily.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Making huge immutable datasets deeply reactive.
    • Optimising before measuring.

    Likely follow-up questions

    • When is shallowRef the right choice?
    • What's the difference between v-if and v-show?
    Example strong answer

    I'd start by measuring with Vue DevTools' performance timeline and the browser profiler to find what's actually slow. For load time: lazy-load routes and heavy components with defineAsyncComponent, and check the bundle. For runtime: big datasets that never change don't need deep reactivity, so shallowRef or markRaw avoids the proxy overhead; derived values go in computed properties so they're cached; long lists get virtualised; and v-memo can skip re-rendering list rows whose inputs haven't changed. v-show is better than v-if for things toggled often. And I keep props stable so child components don't update needlessly.

    Practise this question and get feedback
  8. 8.

    What does Nuxt add on top of Vue, and when would you use it?

    IntermediateTechnical

    What the interviewer is evaluating

    Knowledge of the Vue meta-framework ecosystem.

    Key points a strong answer covers

    • SSR / SSG. Server-side rendering, static generation and hybrid rendering per route.
    • File-based routing. File-based routing and layouts.
    • Data fetching. useFetch/useAsyncData and server API routes (Nitro).
    • Conventions / auto-imports. Auto-imports, modules and SEO helpers.
    • When. Use it for SEO-sensitive sites; a plain Vue SPA is fine for internal dashboards.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Using Nuxt for a simple internal tool that doesn't need SSR.
    • Fetching with plain fetch in setup during SSR and double-fetching.

    Likely follow-up questions

    • Why use useFetch instead of fetch in a Nuxt page?
    • What is Nitro?
    Example strong answer

    Nuxt is the meta-framework for Vue, like Next.js for React. It adds server-side rendering, static generation and per-route hybrid rendering; file-based routing with layouts and middleware; data fetching with useFetch and useAsyncData, which fetch on the server and pass the result to the client so it isn't fetched twice; server API routes through its Nitro engine; and conventions like auto-imports and SEO helpers. I'd choose it for public, SEO-sensitive sites — e-commerce, content, marketing — or when I want server routes in the same project. For an internal dashboard behind a login, a plain Vue SPA with Vite is often simpler.

    Practise this question and get feedback

JavaScript interview questions

Closures, the event loop, async code, scope and the prototype chain — the core of every front-end and Node.js interview.

  1. 1.

    Explain closures in JavaScript, with a practical example.

    BeginnerTechnical

    What the interviewer is evaluating

    Whether you understand lexical scope and can connect it to real code, not just recite a definition.

    Key points a strong answer covers

    • Function + outer scope. A closure is a function bundled with references to the variables of the scope it was created in.
    • Variables stay alive. The captured variables live on after the outer function returns.
    • Practical use. Private state, factories, memoisation, debounce/throttle and event handlers all rely on closures.
    • Pitfall. Watch for stale values (e.g. in React effects), var in loops, and accidentally retaining large objects.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Saying a closure is “a function inside a function” without explaining what it captures.
    • No example — interviewers want to see you've used one.

    Likely follow-up questions

    • What does for (var i = 0; i < 3; i++) setTimeout(() => console.log(i)) print, and why?
    • How can a closure cause a memory leak?
    Example strong answer

    A closure is a function together with the variables from the scope where it was defined. Because the function keeps a reference to that scope, those variables stay alive even after the outer function has returned. A simple example is a counter factory: makeCounter() declares let count = 0 and returns a function that increments it — each counter has its own private count. I use closures every day for event handlers, debounce helpers and module-private state. The main pitfall is stale values: a React effect or a timer can capture an old variable, so you need the right dependencies or a ref.

    Practise this question and get feedback
  2. 2.

    What is the event loop, and how do microtasks differ from macrotasks?

    IntermediateTechnical

    What the interviewer is evaluating

    Whether you can predict the order async code runs in, which matters for debugging race conditions and UI jank.

    Key points a strong answer covers

    • Single thread + call stack. JavaScript runs one call stack on a single thread; the event loop decides what runs next.
    • Task queue. Timers, I/O and UI events queue (macro)tasks.
    • Microtasks first. After each task, all queued microtasks (promise callbacks, await continuations) run before the next task.
    • Rendering / blocking. Long synchronous work or endless microtasks block rendering.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Saying setTimeout(fn, 0) runs immediately.
    • Forgetting that microtasks drain completely before the browser can paint.

    Likely follow-up questions

    • In what order do console.log, setTimeout and Promise.resolve().then log?
    • How would you break up a long-running loop so the page stays responsive?
    Example strong answer

    JavaScript runs on one thread with one call stack. The event loop takes the next task — a timer callback, an I/O completion or a UI event — and runs it to completion. After every task it drains the microtask queue, which holds promise reactions and await continuations, and only then can the browser render and pick the next task. So console.log('a'); setTimeout(() => log('b')); Promise.resolve().then(() => log('c')); log('d') prints a, d, c, b. In practice that's why a heavy synchronous loop freezes the UI; I split long work into chunks with setTimeout or scheduler.yield, or move it to a Web Worker.

    Practise this question and get feedback
  3. 3.

    What's the difference between var, let and const?

    BeginnerTechnical

    What the interviewer is evaluating

    Basic language fluency: scope, hoisting and immutability of bindings.

    Key points a strong answer covers

    • Function vs block scope. var is function-scoped; let and const are block-scoped.
    • Hoisting / TDZ. All are hoisted, but var is initialised to undefined while let/const sit in the temporal dead zone until declared.
    • const binding, not value. const stops reassignment, not mutation — a const object can still change.
    • Re-declaration. var allows re-declaration in the same scope; let/const don't.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Claiming const makes objects immutable.
    • Saying let and const aren't hoisted at all.

    Likely follow-up questions

    • How would you make an object truly read-only?
    • Why does var in a for-loop cause bugs with callbacks?
    Example strong answer

    var is function-scoped, can be re-declared, and is hoisted and initialised to undefined, so you can read it before the declaration line. let and const are block-scoped; they're hoisted too, but they're in the temporal dead zone until the declaration runs, so early access throws. const prevents reassigning the binding, not changing the value — const user = {} can still get new properties; for a read-only object you'd use Object.freeze, which is shallow. In modern code I default to const, use let when a value really changes, and avoid var.

    Practise this question and get feedback
  4. 4.

    Explain promises and async/await. How do you handle errors and run requests in parallel?

    IntermediateTechnical

    What the interviewer is evaluating

    Practical async skills: error handling, sequencing and concurrency.

    Key points a strong answer covers

    • Promise states. A promise is pending, then fulfilled or rejected, once.
    • async/await is syntax over promises. An async function returns a promise; await pauses that function until the promise settles.
    • Error handling. Use try/catch around awaits (or .catch), and never leave a rejection unhandled.
    • Parallel vs sequential. Awaiting in a loop is sequential; Promise.all runs them together; allSettled waits for every result.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Awaiting independent requests one by one, making the page slower.
    • Using Promise.all without considering that one rejection fails the whole batch.

    Likely follow-up questions

    • When would you choose Promise.allSettled over Promise.all?
    • How would you limit concurrency to five requests at a time?
    Example strong answer

    A promise represents a value that will arrive later; it's pending, then fulfilled or rejected exactly once. async/await is syntax over promises: an async function always returns a promise, and await pauses just that function until the promise settles, so code reads top to bottom. For errors I wrap awaits in try/catch, or attach .catch when I'm not awaiting. If requests don't depend on each other I start them together with Promise.all, which rejects as soon as one fails; when I need every outcome — say, uploading ten files and reporting which failed — I use Promise.allSettled. For large batches I limit concurrency with a small pool.

    Practise this question and get feedback
  5. 5.

    How is the value of this determined in JavaScript?

    IntermediateTechnical

    What the interviewer is evaluating

    Whether you understand call-site binding — a frequent source of bugs in callbacks and classes.

    Key points a strong answer covers

    • Depends on the call. this is set by how a function is called, not where it's written.
    • Method / default binding. obj.fn() sets this to obj; a plain call gives undefined in strict mode (the global object otherwise).
    • Explicit binding. call, apply and bind set this explicitly.
    • Arrow functions. Arrow functions don't have their own this; they use the enclosing scope's.
    • new. With new, this is the newly created object.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Saying this refers to the function itself.
    • Not knowing why a method loses this when passed as a callback.

    Likely follow-up questions

    • Why does setTimeout(obj.method, 100) lose this, and how do you fix it?
    • When would you avoid an arrow function as an object method?
    Example strong answer

    this is decided by the call, not the definition. Called as a method — user.greet() — this is user. Called as a plain function, it's undefined in strict mode or the global object otherwise. call, apply and bind set it explicitly, and with new it's the newly created instance. Arrow functions don't bind their own this; they take it from the surrounding scope, which is why they're handy in callbacks inside class methods. A classic bug is passing obj.method to setTimeout or an event listener: it's called without the object, so this is lost — fix it with obj.method.bind(obj) or an arrow wrapper.

    Practise this question and get feedback
  6. 6.

    Explain prototypal inheritance. How do ES6 classes relate to it?

    IntermediateTechnical

    What the interviewer is evaluating

    Depth of language knowledge beyond syntax.

    Key points a strong answer covers

    • Prototype chain. Objects link to a prototype; property lookups walk up the chain until found or null.
    • Shared methods. Methods on the prototype are shared by all instances rather than copied.
    • Classes are syntax. class is mostly syntax over constructor functions and prototypes.
    • Creating links. Object.create, constructor functions and extends set up the prototype link.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Describing JavaScript classes as if they copy methods like Java classes.
    • Confusing prototype (on functions) with an object's internal prototype.

    Likely follow-up questions

    • What's the difference between Foo.prototype and Object.getPrototypeOf(foo)?
    • How does hasOwnProperty differ from the in operator?
    Example strong answer

    Every object has an internal link to another object, its prototype. When you read a property that isn't on the object itself, JavaScript looks it up on the prototype, then that object's prototype, and so on until it reaches null. That's how inheritance works: methods live once on a prototype and every instance shares them. ES6 classes are largely syntax over this — class Admin extends User sets Admin.prototype's prototype to User.prototype, and methods in the class body go on the prototype. You can also link objects directly with Object.create(proto). Knowing this helps when debugging instanceof or checking own properties with Object.hasOwn.

    Practise this question and get feedback
  7. 7.

    What is event delegation, and why is it useful?

    BeginnerTechnical

    What the interviewer is evaluating

    DOM fundamentals and awareness of performance with many elements.

    Key points a strong answer covers

    • Bubbling. Most events bubble from the target up through its ancestors.
    • One listener on a parent. Attach one listener to a common parent instead of one per child.
    • Identify the target. Use event.target.closest(selector) to find which child was clicked.
    • Benefits. Works for elements added later and uses fewer listeners.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Using event.target directly when the click lands on a nested icon inside the button.
    • Forgetting events like focus don't bubble (use focusin).

    Likely follow-up questions

    • What's the difference between event.target and event.currentTarget?
    • How do stopPropagation and preventDefault differ?
    Example strong answer

    Events bubble: a click on a list item also fires on the list and every ancestor. Event delegation uses that by putting one listener on a parent — say the <ul> of a long to-do list — and working out which child was clicked with event.target.closest('li'). It means fewer listeners and it automatically handles items added later, which is ideal for tables or infinite lists. Two things to watch: use closest because the target might be an icon inside the button, and some events such as focus don't bubble, so you'd use focusin instead.

    Practise this question and get feedback
  8. 8.

    What's the difference between == and ===? What about Object.is?

    BeginnerTechnical

    What the interviewer is evaluating

    Precision about type coercion.

    Key points a strong answer covers

    • Coercion. == converts types before comparing; === doesn't.
    • Strict equality. === requires the same type and value.
    • Edge cases. null == undefined is true; NaN === NaN is false; objects compare by reference.
    • Object.is. Object.is is like === but treats NaN as equal to itself and +0/-0 as different.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Saying == compares values and === compares references.
    • Not mentioning that objects are compared by reference with both.

    Likely follow-up questions

    • Why is [] == false true?
    • How would you compare two objects by their contents?
    Example strong answer

    === is strict equality: same type and same value, no conversion. == applies type coercion first, which produces surprises like '0' == false and [] == false both being true. The one coercion I find genuinely useful is x == null, which catches both null and undefined. Objects and arrays are compared by reference with either operator, so two identical-looking objects aren't equal. Object.is is like === except Object.is(NaN, NaN) is true and Object.is(0, -0) is false. In code I use === by default and lint against ==.

    Practise this question and get feedback
  9. 9.

    What's the difference between debounce and throttle? When would you use each?

    IntermediateTechnical

    What the interviewer is evaluating

    Practical performance techniques for event-heavy UIs.

    Key points a strong answer covers

    • Debounce waits for a pause. Debounce runs once after events stop for a set time.
    • Throttle limits rate. Throttle runs at most once per interval while events keep firing.
    • Use cases. Debounce: search-as-you-type, autosave. Throttle: scroll, resize, mousemove.
    • Implementation. Both are built with timers (and a closure holding the timer id).

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Mixing up which is which.
    • Debouncing scroll position tracking so it only updates after the user stops.

    Likely follow-up questions

    • How would you implement debounce in a few lines?
    • What does a leading-edge debounce do?
    Example strong answer

    Both limit how often a function runs during a burst of events. Debounce waits until the events stop for, say, 300 ms and then runs once — ideal for search-as-you-type so you send one request when the user pauses, or for autosave. Throttle runs at most once per interval while the events keep coming — good for scroll or resize handlers that need regular updates. Debounce is a closure holding a timer: each call clears the previous timeout and sets a new one. Throttle tracks the last run time or uses a timer flag. Where available, requestAnimationFrame is often the best throttle for visual updates.

    Practise this question and get feedback
  10. 10.

    How do you copy an object in JavaScript? What's the difference between a shallow and a deep copy?

    IntermediateTechnical

    What the interviewer is evaluating

    Understanding of references and immutable update patterns.

    Key points a strong answer covers

    • Shallow copy. Spread and Object.assign copy only the top level; nested objects are still shared.
    • Deep copy. A deep copy duplicates nested objects too; structuredClone does this natively.
    • JSON trick limits. JSON.parse(JSON.stringify(x)) loses dates, functions, undefined, Maps and cycles.
    • Why it matters. Accidental shared references cause state bugs, especially in React/Redux.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Thinking spread makes a full independent copy.
    • Recommending the JSON trick without its limitations.

    Likely follow-up questions

    • What can't structuredClone copy?
    • How would you update a nested property immutably?
    Example strong answer

    Assigning an object just copies the reference. Spread ({...obj}) and Object.assign make a shallow copy: the top-level properties are new, but nested objects are still shared, so changing copy.address.city changes the original. For a deep copy I use structuredClone, which handles nested objects, arrays, Dates, Maps and even cycles — but not functions or DOM nodes. The old JSON.parse(JSON.stringify()) trick loses dates, undefined and functions. In React state I usually don't deep copy at all; I copy just the path I'm changing, like {...user, address: {...user.address, city}}.

    Practise this question and get feedback
  11. 11.

    Compare ES modules and CommonJS.

    IntermediateTechnical

    What the interviewer is evaluating

    Familiarity with tooling and how code is loaded in browsers and Node.

    Key points a strong answer covers

    • Syntax. ESM uses import/export; CommonJS uses require and module.exports.
    • Static vs dynamic. ESM imports are static, enabling tree shaking; require is a runtime call.
    • Loading. ESM loads asynchronously and supports top-level await; CommonJS loads synchronously.
    • Interop. Node chooses via "type": "module" or .mjs/.cjs; interop has rough edges.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Not knowing why tree shaking needs static imports.
    • Ignoring that exports in ESM are live bindings.

    Likely follow-up questions

    • What is a dynamic import() used for?
    • Why might a library ship both ESM and CommonJS builds?
    Example strong answer

    ES modules use import and export; CommonJS uses require and module.exports. ESM imports are static — they're resolved before the code runs — so bundlers can tree-shake unused exports, and the browser supports ESM natively. require is an ordinary synchronous function call at runtime, which is flexible but harder to analyse. ESM loads asynchronously, supports top-level await and exports live bindings. In Node, the package's "type" field or the .mjs/.cjs extension decides which system a file uses. For code splitting I use dynamic import(), which returns a promise.

    Practise this question and get feedback
  12. 12.

    How do memory leaks happen in a JavaScript application, and how would you find one?

    AdvancedTechnical

    What the interviewer is evaluating

    Debugging maturity on long-lived single-page apps.

    Key points a strong answer covers

    • Garbage collection basics. Memory is freed when objects become unreachable; leaks are unwanted references.
    • Common causes. Forgotten listeners, intervals, subscriptions, growing caches, globals and detached DOM nodes.
    • Tools. Compare heap snapshots in DevTools and look at retainers.
    • Fixes. Clean up in teardown (effects' cleanup), use AbortController, WeakMap for caches.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Saying JavaScript can't leak because it's garbage collected.
    • No method — guessing instead of measuring.

    Likely follow-up questions

    • What's a detached DOM node?
    • How does AbortController help clean up listeners?
    Example strong answer

    JavaScript is garbage collected, so a leak is really an unwanted reference that keeps objects reachable. Common causes in SPAs are event listeners or intervals that are never removed when a component unmounts, subscriptions that aren't cancelled, caches that only grow, and detached DOM nodes still referenced from JS. To find one I reproduce the action several times — open and close a modal ten times — take heap snapshots before and after in Chrome DevTools, and compare what's growing, then follow the retainers to the code holding it. Fixes are cleanup functions in effects, AbortController signals for listeners and fetches, and WeakMap for object-keyed caches.

    Practise this question and get feedback
  13. 13.

    When would you use map, filter, reduce and forEach?

    BeginnerTechnical

    What the interviewer is evaluating

    Idiomatic, readable code and understanding of immutability.

    Key points a strong answer covers

    • map transforms. map returns a new array of the same length with each item transformed.
    • filter selects. filter returns a new array with the items that pass a test.
    • reduce accumulates. reduce combines items into one value — a total, an object, a group-by.
    • forEach for side effects. forEach is for side effects and returns undefined; it can't be chained or broken out of.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Using map just to loop (and ignoring the returned array).
    • Writing unreadable reduce calls when map + filter is clearer.

    Likely follow-up questions

    • How would you group an array of orders by customer?
    • Which of these mutate the original array?
    Example strong answer

    map transforms every item and returns a new array of the same length — turning API records into view models, for example. filter returns the items that pass a test, like active users. reduce folds the array into one value: a sum, a lookup object, or grouping orders by customer. forEach is for side effects such as logging; it returns undefined and you can't break out of it. None of them mutate the original array, which suits React state. I prefer a readable filter then map over a clever reduce, and for very large data I'd use a single loop.

    Practise this question and get feedback
  14. 14.

    Does fetch reject on a 404 or 500 response? How do you handle HTTP errors properly?

    IntermediateTechnical

    What the interviewer is evaluating

    Real-world API handling and robustness.

    Key points a strong answer covers

    • Only network errors reject. fetch only rejects on network failures; HTTP errors still resolve.
    • Check response.ok. Check response.ok or the status code and throw yourself.
    • Timeouts / aborts. Use AbortController (or AbortSignal.timeout) for timeouts and cancellation.
    • User-facing handling. Parse the error body, show a useful message, and retry only safe requests.

    Suggested answer structure

    1. Define it in one sentence.
    2. Explain how it works underneath.
    3. Give a practical example from code or a project.
    4. Close with a trade-off, pitfall or when you'd use it.

    Common mistakes

    • Assuming a try/catch around fetch catches 500 errors.
    • Never cancelling requests when a component unmounts.

    Likely follow-up questions

    • How would you add a 10-second timeout?
    • Which requests is it safe to retry automatically?
    Example strong answer

    No — fetch only rejects for network-level failures such as DNS errors or the connection dropping. A 404 or 500 resolves normally, so I always check response.ok (or the status) and throw an error with the status and the parsed error body. I wrap that in a small API helper so every call handles it the same way. For timeouts and cancellation I pass an AbortController signal — AbortSignal.timeout(10000) for a deadline, and aborting on unmount so stale responses don't update the UI. I'd only auto-retry idempotent requests like GETs, with backoff.

    Practise this question and get feedback

Behavioural & HR questions you'll also get

These come up in almost every vue.js developer interview. Story questions are best answered with STAR — Situation, Task, Action, Result.

  • Tell me about yourself.

    BeginnerHR

    What the interviewer is evaluating

    Whether you can give a concise, relevant pitch that frames your experience around this job.

    Key points a strong answer covers

    • Present. Start with your current role and what you do.
    • Relevant past. Pick the most relevant past experience.
    • Strength / achievement. Include one strength or achievement with evidence.
    • Why this role. Finish with why this role is the next step.

    Suggested answer structure

    1. Present — your current role in one or two sentences.
    2. Past — the experience most relevant to this job.
    3. Proof — one achievement or strength with evidence.
    4. Future — why this role is the logical next step.

    Common mistakes

    • Reciting your whole CV chronologically.
    • Personal life story unrelated to the job.
    • Going over two minutes.

    Likely follow-up questions

    • Why are you looking to leave your current role?
    • What would your manager say is your biggest strength?
    Example strong answer

    I'm a front-end developer with four years' experience, currently at a fintech start-up where I build the customer dashboard in React and TypeScript. Before that I spent two years at an agency building e-commerce sites, which taught me to work fast with lots of different clients. The thing I'm proudest of recently is leading our move to a shared component library, which cut the time to build new screens by about a third. I'm now looking for a role where I can work on a larger product with a strong design system, which is exactly what drew me to this position.

  • Why should we hire you?

    BeginnerHR

    What the interviewer is evaluating

    Whether you understand the role and can match your strengths to its needs with evidence.

    Key points a strong answer covers

    • Role's needs. Show you understand what the role needs.
    • Matching strengths. Match two or three strengths to those needs.
    • Evidence. Back each with evidence.
    • Enthusiasm. Close with genuine enthusiasm.

    Suggested answer structure

    1. Name the two or three things the role needs most.
    2. Match each with your experience and evidence.
    3. Add what makes you different.
    4. Finish with genuine interest.

    Common mistakes

    • Generic claims like 'I'm hardworking' with no evidence.
    • Comparing yourself to other candidates you don't know.

    Likely follow-up questions

    • What would you do in your first 90 days?
    • What's one area where you'd need support?
    Example strong answer

    From the job description and our conversation, you need someone who can take ownership of the customer onboarding process, work with sales and product, and improve the numbers. I've done exactly that for three years: at my current company I redesigned onboarding for new accounts and cut the time to first value from 14 days to 6. I'm comfortable working across teams — I run a weekly session with sales and product on customer feedback — and I'm very data-driven, so I'd measure everything from day one. I'm also genuinely excited about your product, because it solves a problem I've seen customers struggle with.

  • Tell me about a time you disagreed with a teammate. How did you handle it?

    BeginnerBehavioural

    What the interviewer is evaluating

    Handling conflict constructively and keeping relationships.

    Key points a strong answer covers

    • Listened to their view. Show you listened to understand their view.
    • Used facts / common goal. Bring it back to facts or a shared goal.
    • Resolution & relationship. Resolve it and keep the relationship.

    Suggested answer structure

    1. Situation — one or two sentences of context.
    2. Task — what you were responsible for.
    3. Action — what you did, step by step (say “I”).
    4. Result — what changed, with a number if you can back it up.
    5. Reflection — what you learned or would do differently.

    Common mistakes

    • Making the other person the villain.
    • A story where you were simply right and they gave in.

    Likely follow-up questions

    • What if you couldn't reach agreement?
    • Have you ever been wrong in a disagreement?
    Example strong answer (a fictional story — use your own)

    On a website rebuild, a senior designer wanted an animated, image-heavy homepage, and I was worried it would hurt mobile load times and SEO. As the developer responsible for performance, I needed us to agree before the sprint started. I asked her to walk me through what she was trying to achieve — she wanted the brand to feel premium. I built two quick prototypes, one with her full design and one with lighter animations, and we tested both on a mid-range phone together. Hers took nearly six seconds to load. We agreed on a version that kept the key animation but lazy-loaded the rest. The page launched loading in under two seconds, and she later asked me to review designs earlier. I learned that testing together beats debating.

  • Tell me about a mistake you made and what you learned.

    BeginnerBehavioural

    What the interviewer is evaluating

    Honesty, accountability and learning.

    Key points a strong answer covers

    • Real mistake owned. Own a real mistake.
    • Fixed it. Show how you fixed it and who you told.
    • Changed behaviour. Show what you changed afterwards.

    Suggested answer structure

    1. Situation — one or two sentences of context.
    2. Task — what you were responsible for.
    3. Action — what you did, step by step (say “I”).
    4. Result — what changed, with a number if you can back it up.
    5. Reflection — what you learned or would do differently.

    Common mistakes

    • Choosing a fake mistake like 'I work too hard'.
    • Blaming others.

    Likely follow-up questions

    • How did your manager react?
    • How do you know you haven't repeated it?
    Example strong answer (a fictional story — use your own)

    In my first year as a marketing coordinator, I sent a promotional email to our whole list with the wrong discount code — I'd tested the email but not clicked the code itself. Within an hour customers were complaining that it didn't work. I told my manager immediately, set the wrong code to apply the discount too, and sent a short correction email with an apology. We lost very little revenue, and some customers replied thanking us for the quick fix. Since then I use a pre-send checklist that includes testing every link and code as a customer would, and I asked for a second person to check any campaign to more than 10,000 people.

  • Describe a situation where you worked under pressure or to a tight deadline.

    BeginnerBehavioural

    What the interviewer is evaluating

    Prioritisation, composure and delivery.

    Key points a strong answer covers

    • The pressure. Make the pressure concrete.
    • Prioritised. Show how you prioritised.
    • Communicated. Show how you kept people informed.
    • Delivered. Show the outcome.

    Suggested answer structure

    1. Situation — one or two sentences of context.
    2. Task — what you were responsible for.
    3. Action — what you did, step by step (say “I”).
    4. Result — what changed, with a number if you can back it up.
    5. Reflection — what you learned or would do differently.

    Common mistakes

    • Glorifying working all night as the solution.
    • No mention of prioritising.

    Likely follow-up questions

    • What would you do if it was clear you couldn't make the deadline?
    • How do you stop pressure affecting quality?
    Example strong answer (a fictional story — use your own)

    Two days before a client presentation, our analyst fell ill and I had to finish the market research report she'd been leading. I listed everything left and asked the account director which sections the client cared about most — pricing and competitor comparison. I focused on those, reused verified data from our previous report, and moved the appendix to a follow-up email. I sent a short update each evening so nobody was surprised. We delivered the core report on time, the client approved the next phase, and the appendix followed two days later. I learned to ask early what matters most rather than trying to do everything equally well.

  • What would you do if you realised you were going to miss a deadline?

    BeginnerSituational

    What the interviewer is evaluating

    Transparency and problem solving.

    Key points a strong answer covers

    • Tell people early. Flag it as soon as you know.
    • Assess the gap. Work out how far off you are.
    • Options. Offer options: reduced scope, help, a new date.
    • Prevent repeats. Learn why it happened.

    Suggested answer structure

    1. Clarify the situation and what's at stake.
    2. Say what you'd do first, and why.
    3. Explain who you'd involve and how you'd communicate.
    4. Describe how you'd check the outcome and prevent a repeat.

    Common mistakes

    • Waiting until the deadline to say anything.
    • Promising you'll just work all night.

    Likely follow-up questions

    • What if your manager is unavailable?
    • Has this happened to you?
    Example strong answer

    I'd tell the person depending on it as soon as I realised, not at the deadline. Before that conversation I'd work out how far off I am and why, so I could offer options: delivering the most important part on time and the rest a few days later, getting help from a colleague, or agreeing a new date. Then I'd let them decide what works best for them, and keep them updated. Afterwards I'd look at why it slipped — usually underestimating something — so I plan better next time.

Ready to answer them out loud?

Run a timed vue.js developer mock interview, type or speak your answers, and get a score breakdown with what to improve.

Interview questions for related roles