Role preparation

Frontend Developer interview questions and answers.

JavaScript, browser behaviour, accessible interfaces, and performance.

Questions

Technical questions to practise out loud

  1. 01

    What is a closure in JavaScript?

    A closure is a function bundled with its lexical environment. It retains access to variables from the scope where it was created, even after that outer function returns.

    Read the full breakdown
  2. 02

    How does the JavaScript event loop work?

    JavaScript runs synchronous work on one call stack. Promise callbacks run as microtasks before the browser takes the next macrotask such as a timer or input event, so long synchronous work blocks rendering.

    Read the full breakdown
  3. 03

    What is CORS and how do you debug it?

    CORS is a browser security policy: the server must explicitly allow another origin through response headers. It is not solved in frontend code; inspect the request origin, preflight response, credentials mode, and server headers.

    Read the full breakdown
  4. 04

    How does React rendering work?

    React re-renders when state, props, or consumed context change. Rendering calculates a new UI description; React then reconciles it with the previous tree and commits only the necessary DOM changes.

    Read the full breakdown
  5. 05

    How does TypeScript type narrowing work?

    TypeScript narrows a union after runtime checks such as typeof, in, equality checks, or discriminated union tags. The narrowing is static safety, so the runtime check still must reflect real data.

    Read the full breakdown
  6. 06

    How do you make a web interface accessible?

    Accessible UI starts with semantic HTML and keyboard behaviour. Use native controls where possible, provide visible focus, meaningful labels, correct heading order, and test with keyboard and assistive technology.

    Read the full breakdown
  7. 07

    How do browser caching strategies work?

    Browser caching is controlled by HTTP cache directives and validators. Immutable versioned assets can be cached for a long time, while HTML or API data needs a policy that balances freshness, validation, and offline behaviour.

    Read the full breakdown
  8. 08

    How do you improve web performance?

    Improve performance by measuring the user journey first: identify the largest contentful paint, blocking JS, slow network requests, layout shifts, and unnecessary rendering. Optimise the bottleneck rather than applying random memoisation.

    Read the full breakdown
  9. 09

    What is your frontend testing strategy?

    Test behaviour at the right level: unit tests for pure logic, component tests for interaction and accessibility, and a small end-to-end set for critical journeys. Prefer user-visible assertions over implementation details.

    Read the full breakdown
  10. 10

    How do you choose a state-management approach?

    Keep state as local as possible and derive values instead of duplicating them. Move state upward only for real sharing, use server-state tools for remote data, and choose a global store when cross-tree coordination is stable and justified.

    Read the full breakdown