JavaScript Fundamentals
- Closures and lexical scope
- The event loop, microtasks, and macrotasks
- Prototypal inheritance vs. classes
- Promises, async/await, error handling
- ES6+ features (destructuring, spread, modules)
Q1.Explain closures in JavaScript. Give a practical example.
function createCounter() {
let count = 0;
return {
increment: () => ++count,
getCount: () => count
};
}
Each call to createCounter() creates an independent closure with its own count variable.
Real-world uses of closures:
• Module pattern and data privacy
• Partial application and currying
• Event handlers that reference loop variables
• Memoization
Common gotcha: Closures in loops with `var` capture the same variable — use `let` or an IIFE to fix.Q2.What is the JavaScript event loop? How do microtasks and macrotasks differ?
React & Component Architecture
Q3.Explain the difference between useEffect and useLayoutEffect.
Q4.How do you decide between local state, context, and a state management library?
Web Performance
Q5.What are Core Web Vitals, and how would you optimize each?
Frequently Asked Questions
Should I learn React, Vue, or Angular for interviews?
React has the largest market share and is asked about most frequently. But strong JavaScript fundamentals matter more than framework-specific knowledge. If you already know Vue or Angular well, the concepts transfer.
How important is CSS knowledge in frontend interviews?
Very important. Expect questions on Flexbox, Grid, specificity, responsive design, and animations. Many interviews include building a UI component live, and CSS skills are directly evaluated.
Do frontend developers need to know about accessibility?
Yes — accessibility is increasingly tested. Know ARIA attributes, semantic HTML, keyboard navigation, color contrast requirements, and screen reader basics. Companies face legal requirements (ADA, WCAG).
Don't freeze in your next interview
InterviewsUnlocked gives you real-time AI coaching during live interviews — role-tailored answers, follow-up cues, and confidence when you need it most.
Related Resources
JavaScript Interview Questions & Answers for All Levels
Comprehensive JavaScript interview prep covering closures, prototypes, event loop, ES6+ features, async patterns, and real-world coding challenges with expert answers.
Read moreSkills & TechnologiesReact Interview Questions & Answers: Hooks, Patterns, and Performance
Master React interviews with questions covering hooks, component patterns, state management, performance optimization, and Next.js — with detailed expert answers.
Read moreSkills & TechnologiesCSS Interview Questions & Answers: Layout, Design, and Modern Techniques
Master CSS interviews with questions covering Flexbox, Grid, specificity, responsive design, animations, and modern CSS-in-JS approaches with detailed expert answers.
Read moreInterview TipsTechnical Interview Preparation: A 4-Week Plan
A structured 4-week technical interview preparation plan covering data structures, algorithms, system design, and mock interviews with daily schedules.
Read moreCompany InterviewsMeta (Facebook) Interview Guide: Process & Questions
Complete Meta interview guide covering coding, system design, behavioral, and product sense rounds with common questions and expert answers for all roles.
Read more