Frontend Developer Interview Questions and Answers (React, JavaScript)
JavaScript fundamentals, React, browser behaviour, performance and security: the topics frontend rounds keep coming back to.
Frontend developer questions (8)
01
Explain the JavaScript event loop.
mediumtechnicalProduct & startupsBig tech / MNCWhat the interviewer is checking: Core JavaScript understanding.
A strong answer covers
- JavaScript runs on one thread with a call stack.
- Async work (timers, network) is handled by the browser, which queues callbacks.
- Microtasks (promises) run before the next macrotask (setTimeout).
- This is why a long synchronous loop freezes the page.
02
A React page feels slow. How do you find and fix the cause?
mediumtechnicalProduct & startupsWhat the interviewer is checking: Practical performance debugging.
A strong answer covers
- Measure first: React Profiler, browser Performance tab, Lighthouse.
- Common causes: unnecessary re-renders, large bundles, long lists, heavy images.
- Fixes: memoisation where measured, code splitting, list virtualisation, image optimisation.
- Measure again to confirm.
03
How do you make a web page accessible?
mediumtechnicalBig tech / MNCWhat the interviewer is checking: Awareness that products must work for everyone.
A strong answer covers
- Semantic HTML: buttons, labels, headings in order.
- Keyboard access and visible focus.
- Enough colour contrast and text alternatives for images.
- ARIA only where native HTML cannot do it.
- Test with a screen reader and an automated checker.
04
How do you decide where to keep state in a React app?
mediumtechnicalProduct & startupsWhat the interviewer is checking: Architecture judgement.
A strong answer covers
- Keep state as close as possible to where it is used.
- Lift it up when siblings need it.
- Server data belongs in a data-fetching cache (React Query, SWR), not global state.
- Global stores only for truly app-wide state such as the signed-in user or theme.
05
What is XSS and how do you prevent it?
hardtechnicalBanks & fintechWhat the interviewer is checking: Security basics for the browser.
A strong answer covers
- XSS: an attacker's script runs in your page, often via unescaped user input.
- Frameworks like React escape text by default; avoid dangerouslySetInnerHTML or sanitise first.
- Use a Content Security Policy.
- Keep tokens out of places scripts can read (HttpOnly cookies).
06
Flexbox or Grid: when do you use which?
easytechnicalIT servicesWhat the interviewer is checking: Everyday CSS layout skill.
A strong answer covers
- Flexbox: one-dimensional layouts, a row or a column of items.
- Grid: two-dimensional layouts with rows and columns together.
- They combine well: Grid for the page, Flexbox inside components.
07
What is the difference between server-side rendering and client-side rendering?
mediumtechnicalProduct & startupsBig tech / MNCWhat the interviewer is checking: Understanding of rendering trade-offs for speed and SEO.
A strong answer covers
- Client-side: the browser downloads JavaScript and builds the page; fast after the first load but slower first paint.
- Server-side: the server sends ready HTML; faster first paint and better for SEO.
- Static generation builds pages ahead of time; hydration makes server HTML interactive.
- Frameworks like Next.js mix these per page.
08
What happens when you type a URL into the browser and press Enter?
mediumtechnicalBig tech / MNCProduct & startupsWhat the interviewer is checking: Broad web fundamentals.
A strong answer covers
- DNS lookup turns the domain into an IP address.
- TCP and TLS connection, then the HTTP request.
- Server responds; the browser parses HTML, builds the DOM and CSSOM, runs JavaScript.
- Layout, paint and composite put pixels on screen; caching can skip steps.
Also asked in every frontend developer interview
- Tell me about yourself.
- Why do you want to work here?
- What is your greatest strength?
- What is your biggest weakness?
- Tell me about a time you disagreed with a teammate or manager.
- Tell me about a time you failed.
- Describe a time you worked under a tight deadline.
- Where do you see yourself in five years?
- What are your salary expectations?
- What is your notice period? Can you join early?
- Do you have any questions for us?
- Why are you leaving your current job?

