Frontend Interview Preparation Guide – Questions You’ll Almost Always See If you're preparing for frontend interviews, don’t just revise frameworks. Most companies still test fundamentals across HTML, JavaScript, React, accessibility, and performance. Here’s a structured checklist of commonly asked questions 👇 🟠 HTML Fundamentals Difference between id and class attributes What does the <!DOCTYPE> declaration actually do? What is semantic HTML and why does it matter for SEO and accessibility? Purpose of meta tags (viewport, charset, description, etc.) Difference between <div> and <span> When should you use semantic elements like <section>, <article>, <nav>? Strong HTML knowledge shows you understand how the browser interprets structure. 🟡 JavaScript Core Concepts What are closures? Real-world use cases? var vs let vs const (scope, hoisting, TDZ) How the event loop works (Call Stack, Microtasks, Macrotasks) Prototypal inheritance explained clearly Promises vs async/await == vs === (type coercion) What is hoisting? How do you handle errors (try/catch, async error handling)? Debounce vs throttle — when and why? How would you deep clone an object without libraries? If you can’t explain these without hesitation, revise. 🔵 React Knowledge What is the Virtual DOM and how does reconciliation work? Functional vs class components Why Hooks were introduced Lifting state up Purpose of useEffect How Context API works Controlled vs uncontrolled components Performance optimization strategies (memoization, code splitting) What are React Portals? How to build a custom debounce hook? Interviewers often go deeper into rendering behavior and re-renders. 🟢 Accessibility (A11Y) What is ARIA and why is it needed? How to make forms accessible Common accessibility mistakes Making images accessible (alt, decorative images) What is a screen reader? Accessible navigation menus role="button" vs <button> How to test accessibility (Lighthouse, Axe, keyboard testing) Accessibility is no longer optional in modern frontend roles. 🔴 Performance & Optimization What is lazy loading? How to reduce JavaScript bundle size Why use a CDN? Optimizing CSS delivery What is caching and how it works Critical Rendering Path Improving TTFB Role of service workers in performance At mid-to-senior levels, performance awareness is expected. 🎯 Final Thought Frontend interviews don’t just test React. They test: ✔ Platform fundamentals ✔ Rendering knowledge ✔ Accessibility awareness ✔ Performance thinking ✔ Problem-solving clarity Framework knowledge gets you shortlisted. Web fundamentals get you selected. 👉 Follow Rahul R Jain for more real interview insights, React fundamentals, and practical frontend engineering content. #FrontendEngineering #ReactJS #JavaScript #WebDevelopment #Accessibility #WebPerformance #TechInterviews #SoftwareEngineering #CareerGrowth
Rahul R Jain’s Post
More Relevant Posts
-
Commonly asked React.js Low-Level Design (LLD) interview questions that come up in frontend interviews: 𝟭. 𝗛𝗼𝘄 𝘄𝗼𝘂𝗹𝗱 𝘆𝗼𝘂 𝗶𝗺𝗽𝗹𝗲𝗺𝗲𝗻𝘁 𝗶𝗻𝗳𝗶𝗻𝗶𝘁𝗲 𝘀𝗰𝗿𝗼𝗹𝗹𝗶𝗻𝗴 𝗶𝗻 𝗥𝗲𝗮𝗰𝘁? - Think about how you would detect when the user reaches near the bottom of the page and trigger additional data loading. Also consider techniques like throttling or debouncing to avoid excessive API calls. 𝟮. 𝗛𝗼𝘄 𝘄𝗼𝘂𝗹𝗱 𝘆𝗼𝘂 𝗯𝘂𝗶𝗹𝗱 𝗮 𝘀𝗲𝗮𝗿𝗰𝗵 𝗳𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝗮𝗹𝗶𝘁𝘆 𝘄𝗶𝘁𝗵 𝗹𝗶𝘃𝗲 𝗳𝗶𝗹𝘁𝗲𝗿𝗶𝗻𝗴 𝗶𝗻 𝗮 𝗥𝗲𝗮𝗰𝘁 𝗮𝗽𝗽𝗹𝗶𝗰𝗮𝘁𝗶𝗼𝗻? - Discuss how you would optimise filtering for large datasets, debounce user input, and manage filtered results when interacting with an API. 𝟯. 𝗛𝗼𝘄 𝘄𝗼𝘂𝗹𝗱 𝘆𝗼𝘂 𝗱𝗲𝘀𝗶𝗴𝗻 𝗮 𝗳𝗼𝗿𝗺 𝘄𝗶𝘁𝗵 𝗱𝘆𝗻𝗮𝗺𝗶𝗰 𝗳𝗶𝗲𝗹𝗱𝘀 𝗶𝗻 𝗥𝗲𝗮𝗰𝘁? - Consider how you would structure state for adding and removing fields, handle validation and errors, and decide between controlled vs uncontrolled components. 𝟰. 𝗛𝗼𝘄 𝘄𝗼𝘂𝗹𝗱 𝘆𝗼𝘂 𝗺𝗮𝗻𝗮𝗴𝗲 𝘀𝘁𝗮𝘁𝗲 𝗳𝗼𝗿 𝗮 𝗺𝘂𝗹𝘁𝗶-𝘀𝘁𝗲𝗽 𝗳𝗼𝗿𝗺 𝗶𝗻 𝗥𝗲𝗮𝗰𝘁? - Think about how data from each step is stored, how it can be accessed across steps, and how navigation and validation should be handled. 𝟱. 𝗛𝗼𝘄 𝘄𝗼𝘂𝗹𝗱 𝘆𝗼𝘂 𝗶𝗺𝗽𝗹𝗲𝗺𝗲𝗻𝘁 𝗮 𝗰𝘂𝘀𝘁𝗼𝗺 𝘂𝘀𝗲𝗙𝗲𝘁𝗰𝗵 𝗵𝗼𝗼𝗸 𝗳𝗼𝗿 𝗵𝗮𝗻𝗱𝗹𝗶𝗻𝗴 𝗛𝗧𝗧𝗣 𝗿𝗲𝗾𝘂𝗲𝘀𝘁𝘀? - A good design should manage loading, success, and error states while remaining reusable across multiple components. 𝟲. 𝗛𝗼𝘄 𝘄𝗼𝘂𝗹𝗱 𝘆𝗼𝘂 𝗶𝗺𝗽𝗹𝗲𝗺𝗲𝗻𝘁 𝗹𝗮𝘇𝘆 𝗹𝗼𝗮𝗱𝗶𝗻𝗴 𝗼𝗳 𝗰𝗼𝗺𝗽𝗼𝗻𝗲𝗻𝘁𝘀 𝗶𝗻 𝗥𝗲𝗮𝗰𝘁? - Explain how tools like React.lazy and Suspense can help load components only when they are needed, especially in route-based applications. 𝟳. 𝗛𝗼𝘄 𝘄𝗼𝘂𝗹𝗱 𝘆𝗼𝘂 𝗶𝗺𝗽𝗹𝗲𝗺𝗲𝗻𝘁 𝗮 𝗱𝗿𝗮𝗴𝗴𝗮𝗯𝗹𝗲 𝗹𝗶𝘀𝘁 𝗶𝗻 𝗥𝗲𝗮𝗰𝘁? - This involves managing drag state, updating item order, and ensuring the implementation remains performant. 𝟴. 𝗛𝗼𝘄 𝘄𝗼𝘂𝗹𝗱 𝘆𝗼𝘂 𝗱𝗲𝘀𝗶𝗴𝗻 𝗮𝘂𝘁𝗵𝗲𝗻𝘁𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗮𝗻𝗱 𝗮𝘂𝘁𝗵𝗼𝗿𝗶𝘇𝗮𝘁𝗶𝗼𝗻 𝗶𝗻 𝗮 𝗥𝗲𝗮𝗰𝘁 𝗮𝗽𝗽𝗹𝗶𝗰𝗮𝘁𝗶𝗼𝗻? - Consider protected routes, redirecting unauthenticated users, token-based authentication (such as JWT), and handling token expiration. These questions are great for evaluating a candidate’s understanding of state management, performance optimization, component design, and real-world frontend architecture. Which other React LLD questions do you think interviewers should ask? Share in the comments! Like. Repost. Save for later. -- Advanced frontend interview preparation resources: https://lnkd.in/dTPdEYwz
To view or add a comment, sign in
-
💡 JavaScript Interview Question: Promise.all() vs Promise.allSettled() While preparing for frontend interviews, one question that often comes up is: 👉 What is the difference between Promise.all() and Promise.allSettled()? Here is a simple way to explain it in interviews. 🔹 Promise.all() Promise.all() takes multiple promises and runs them in parallel. It resolves only when all promises are successful. If any one promise fails, the entire Promise.all() fails immediately. 📌 Example const p1 = Promise.resolve("API 1 success"); const p2 = Promise.resolve("API 2 success"); const p3 = Promise.reject("API 3 failed"); Promise.all([p1, p2, p3]) .then(res => console.log(res)) .catch(err => console.log("Error:", err)); Output: Error: API 3 failed ✔️ When to use: When all results are required to proceed. Example: Loading multiple dependencies before rendering a page. 🔹 Promise.allSettled() Promise.allSettled() waits for all promises to complete, regardless of success or failure. It returns the status of each promise (fulfilled or rejected). 📌 Example Promise.allSettled([p1, p2, p3]).then(res => console.log(res)); Output: [ { status: "fulfilled", value: "API 1 success" }, { status: "fulfilled", value: "API 2 success" }, { status: "rejected", reason: "API 3 failed" } ] ✔️ When to use: When you want results from all APIs even if some fail. Example: Dashboard widgets where each API is independent. 🎯 How I answer this in interviews Promise.all() → fails fast if any promise fails. Promise.allSettled() → waits for all promises and returns each result. 💬 Follow-up interview question "What if you want successful responses even when some APIs fail?" Answer: Use Promise.allSettled() and filter fulfilled results. const results = await Promise.allSettled(promises); const success = results .filter(r => r.status === "fulfilled") .map(r => r.value); Understanding these small JavaScript concepts deeply can make a big difference in frontend interviews. #javascript #reactjs #frontenddeveloper #webdevelopment #interviewprep #mernstack
To view or add a comment, sign in
-
Cracking JavaScript Interviews? Closures are one of the secret weapon. A closure is when a function “remembers” the variables from its outer scope even after that outer function has finished executing. Interviewers love closures because they test how deeply you understand - Scope - Execution context - Under the hood working of JS Prepare for questions like: 1. Why are closures useful? 2. When is a closure formed? 3. What problems can closures cause? Following are some of the "Real World Use Cases" 1. Simulating Private Variables Closures can hide data from the outside world. function createUser(){ let password = "secret"; return { check: (input) => input === password }; } Here, password is inaccesible directly. Only `check` can see it. 2. Creating a Static-like counter Closures help functions remember values across calls. function counter() { let count = 0; return () => ++count; } let count = counter(); count(); // 1 count(); // 2 count(); // 3 Each call updates the same count. 3. Module Pattern Closures hide implementation details. const calculator = (function() { let result = 0; return { add: (x) => result += x }; })(); `result` stays private inside the module. If you’re preparing for frontend or full-stack interviews, don’t just memorize the definition. Write your own counter. Break it. Fix it. Understand it. Closures aren’t just a topic. They’re a mindset shift. Follow for more JavaScript interview breakdowns #JS #JavaScript #InterviewQuestions #KeepLearning
To view or add a comment, sign in
-
-
🚀 React Interview Questions Asked in recent interview (For Mid–Senior Frontend Developers) During interviews, many React questions are not about definitions but about understanding how React behaves internally. Here are some commonly asked questions along with clear explanations. 1️⃣ Multiple components are rendering and the app becomes slow — why? When multiple components re-render frequently, performance can degrade. This usually happens because React re-renders a component whenever its state or props change. Common causes: Parent component re-renders, causing all child components to re-render. Passing new object/array references in props. Inline functions created on every render. Expensive computations inside render. Example problem: <Child data={{ name: "John" }} /> Even if the value is the same, a new object reference is created on every render, so React treats it as a change. Solutions: Use React.memo for child components. Avoid inline objects/functions. Memoize values with useMemo. Memoize callbacks with useCallback. 2️⃣ Dependency array exists in useEffect, but I still want to avoid unnecessary re-renders Important concept: useEffect does not control rendering. Rendering happens because of state or prop changes, not because of useEffect. Example: useEffect(() => { fetchData(); }, [userId]); This only controls when the effect runs, not when the component renders. Ways to reduce unnecessary renders: Avoid unnecessary state updates Use React.memo Use useMemo / useCallback Lift state only when needed 3️⃣ What is Hydration in React? Hydration is mainly used in server-side rendering frameworks like Next.js. Steps: Server renders HTML. Browser receives fully rendered HTML. React attaches event listeners and makes it interactive. Example flow: Server: HTML sent to browser Client: React attaches JS behavior to existing HTML This process is called hydration. If the server HTML and client render output differ, React throws a hydration mismatch warning. Common causes: Random values Date/time differences Browser-only APIs 4️⃣ React Strict Mode in Development vs Production React.StrictMode is a development tool. Development behavior: Components render twice intentionally Helps detect side effects Warns about unsafe lifecycle methods Important point: Strict Mode does NOT affect production. Double rendering happens only in development. Purpose: Detect bugs early Ensure components are resilient 5️⃣ Same hook behaves differently in two sibling components — why? Hooks are isolated per component instance. Example: <ComponentA /> <ComponentB /> Even if both use the same hook: const [count, setCount] = useState(0); Each component maintains its own independent state. Possible reasons behavior differs: Different props Different lifecycle timing Conditional rendering Parent re-rendering one child more often #ReactJS #FrontendDevelopment #JavaScript #ReactInterview #WebDevelopment #NextJS #SoftwareEngineering #FrontendEngineer #ReactHooks #CodingInterview
To view or add a comment, sign in
-
🚀 Angular Interview Questions with Detailed Answers (Mid–Senior Frontend Developers) Angular interviews often focus on change detection, performance optimization, and architecture decisions rather than just definitions. Here are some practical interview questions with clear explanations. 1️⃣ Why does an Angular component re-render multiple times and become slow? Angular updates the UI through its change detection mechanism. Every time an event occurs (click, HTTP response, timer, input change), Angular runs change detection to check if values have changed. If your component becomes slow, common reasons are: Large component trees Heavy logic inside templates Frequent change detection cycles Using default change detection instead of optimized strategies Example problem: <li *ngFor="let item of items"> {{ calculateHeavyValue(item) }} </li> Here, calculateHeavyValue() runs every change detection cycle, which can slow down the app. Solutions: Use pure pipes Move heavy logic outside templates Use trackBy in ngFor Use ChangeDetectionStrategy.OnPush 2️⃣ How do you avoid unnecessary change detection in Angular? Angular provides OnPush change detection strategy. Example: @Component({ selector: 'app-user', templateUrl: './user.component.html', changeDetection: ChangeDetectionStrategy.OnPush }) With OnPush, Angular only checks the component when: Input reference changes Event occurs inside the component Observable emits new value Manual trigger using markForCheck() This significantly improves performance in large applications. 3️⃣ What is the difference between constructor and ngOnInit? This is a very common Angular interview question. Constructor Used for dependency injection Called when the class instance is created Should not contain business logic Example: constructor(private userService: UserService) {} ngOnInit Lifecycle hook Runs after Angular initializes component inputs Used for component initialization Example: ngOnInit() { this.loadUser(); } Rule: Use constructor for injection and ngOnInit for logic. 4️⃣ Why use trackBy in ngFor? Without trackBy, Angular recreates DOM elements whenever the list changes. Example without trackBy: <li *ngFor="let user of users"> {{user.name}} </li> If one item changes, Angular rebuilds the entire list DOM. Using trackBy: <li *ngFor="let user of users; trackBy: trackById"> {{user.name}} </li> trackById(index: number, user: any) { return user.id; } Now Angular only updates the changed items, improving performance. 5️⃣ Why does Angular subscribe multiple times to the same observable? This happens when using cold observables. Example: this.http.get('/api/users') Each subscription triggers a new HTTP request. Solution: Use shareReplay() to share the response. this.users$ = this.http.get('/api/users').pipe( shareReplay(1) ); #Angular #AngularInterview #FrontendDevelopment #TypeScript #WebDevelopment #SoftwareEngineering #RxJS #FrontendEngineer #CodingInterview #AngularDevelopers
To view or add a comment, sign in
-
🚀 Frontend Interview Experience – Scenario-Based React Questions (with Solutions + Code) Recently I faced a React interview focused purely on real-world scenarios instead of theory. Here’s how I approached each problem 👇 💡 1. Infinite Scrolling (LinkedIn feed) Use Intersection Observer instead of scroll events for better performance. const observer = new IntersectionObserver((entries) => { if (entries[0].isIntersecting) { fetchMoreData(); } }); observer.observe(loaderRef.current); 👉 Optimize with react-window (virtualization) 💡 2. Auto Logout after 30 mins inactivity Track user activity and reset timer. useEffect(() => { let timer; const resetTimer = () => { clearTimeout(timer); timer = setTimeout(logout, 30 * 60 * 1000); }; window.addEventListener("mousemove", resetTimer); window.addEventListener("keydown", resetTimer); resetTimer(); return () => { window.removeEventListener("mousemove", resetTimer); window.removeEventListener("keydown", resetTimer); }; }, []); 💡 3. Multi-language Support (i18n) Using react-i18next import { useTranslation } from "react-i18next"; const { t } = useTranslation(); <h1>{t("welcome")}</h1>; 💡 4. Upload Large Files (100MB+) Use chunk upload const chunkSize = 5 * 1024 * 1024; // 5MB chunks for (let i = 0; i < file.size; i += chunkSize) { const chunk = file.slice(i, i + chunkSize); uploadChunk(chunk); } 💡 5. React SPA SEO issue (not indexed) Use Next.js (SSR) or prerendering. // Example meta handling import { Helmet } from "react-helmet"; <Helmet> <title>My Page</title> </Helmet> 💡 6. Fix stale closures (useEffect) const latest = useRef(value); useEffect(() => { latest.current = value; }, [value]); 💡 7. Reduce bundle size const LazyComponent = React.lazy(() => import("./Component")); 👉 Also use tree-shaking & remove unused libs 💡 8. Role-based routes (Admin only) const ProtectedRoute = ({ children }) => { const user = getUser(); return user.role === "admin" ? children : <Navigate to="/unauthorized" />; }; 💡 9. Smooth animations (Framer Motion) <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} /> 💡 10. API rate limiting (Debounce) import debounce from "lodash.debounce"; const search = debounce((value) => { fetchData(value); }, 500); 📌 Key Takeaway: Modern interviews test your ability to build scalable, production-ready solutions, not just theory. 💬 How would you approach these problems? Let’s discuss! #React #Frontend #WebDevelopment #JavaScript #InterviewPrep #SoftwareEngineering
To view or add a comment, sign in
-
𝗜𝗳 𝘆𝗼𝘂 𝗮𝗿𝗲 𝗽𝗿𝗲𝗽𝗮𝗿𝗶𝗻𝗴 𝗳𝗼𝗿 𝗳𝗿𝗼𝗻𝘁𝗲𝗻𝗱 𝗶𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄𝘀, 𝘁𝗵𝗲𝗿𝗲 𝗮𝗿𝗲 𝗮 𝗳𝗲𝘄 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗰𝗼𝗻𝗰𝗲𝗽𝘁𝘀 𝘁𝗵𝗮𝘁 𝗰𝗼𝗺𝗲 𝘂𝗽 𝗮𝗴𝗮𝗶𝗻 𝗮𝗻𝗱 𝗮𝗴𝗮𝗶𝗻. 𝟭. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝘁𝗵𝗲 𝘁𝗵𝗶𝘀 𝗸𝗲𝘆𝘄𝗼𝗿𝗱? - Refers to the object that is currently executing the function - In the global scope, this refers to the window object in browsers - Arrow functions do not have their own this; they inherit it from the surrounding scope 𝟮. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗣𝗿𝗼𝘁𝗼𝘁𝘆𝗽𝗮𝗹 𝗜𝗻𝗵𝗲𝗿𝗶𝘁𝗮𝗻𝗰𝗲? - JavaScript objects inherit properties and methods from other objects through a prototype chain - Every object has an internal [[Prototype]] (accessed via __proto__) - ES6 classes are essentially syntactic sugar over prototypal inheritance 𝟯. 𝗪𝗵𝗮𝘁 𝗮𝗿𝗲 𝘁𝗵𝗲 𝗦𝗽𝗿𝗲𝗮𝗱 𝗮𝗻𝗱 𝗥𝗲𝘀𝘁 𝗼𝗽𝗲𝗿𝗮𝘁𝗼𝗿𝘀 (...)? - Spread expands arrays or objects: const newArr = [...arr, 4, 5] - Rest collects remaining arguments into an array: function fn(a, ...rest) {} - Useful for copying arrays and objects without mutation 𝟰. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗗𝗲𝘀𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗶𝗻𝗴? - A concise way to extract values from arrays or objects into variables - Example with arrays: const [first, second] = [1, 2] - Example with objects: const { name, age } = user - Supports default values like const { name = 'Guest' } = user 𝟱. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗘𝘃𝗲𝗻𝘁 𝗗𝗲𝗹𝗲𝗴𝗮𝘁𝗶𝗼𝗻? - Instead of adding event listeners to every child element, attach one listener to a parent - Works because events bubble up the DOM tree - event.target can be used to determine which element triggered the event 𝟲. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝘁𝗵𝗲 𝗱𝗶𝗳𝗳𝗲𝗿𝗲𝗻𝗰𝗲 𝗯𝗲𝘁𝘄𝗲𝗲𝗻 𝗰𝗮𝗹𝗹() 𝗮𝗻𝗱 𝗮𝗽𝗽𝗹𝘆()? - Both allow you to explicitly set the value of this - call() invokes the function immediately and accepts arguments individually - apply() invokes the function immediately but accepts arguments as an array 𝟳. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗠𝗲𝗺𝗼𝗶𝘇𝗮𝘁𝗶𝗼𝗻? - A technique for caching the result of function calls - Prevents recomputation for the same inputs - Improves performance for expensive or repeated operations - Often implemented using closures with objects or Maps 𝟴. 𝗪𝗵𝗮𝘁 𝗮𝗿𝗲 𝗛𝗶𝗴𝗵𝗲𝗿-𝗢𝗿𝗱𝗲𝗿 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀? - Functions that take other functions as arguments or return them - Examples include map(), filter(), reduce(), and forEach() 𝟵. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝘁𝗵𝗲 𝗱𝗶𝗳𝗳𝗲𝗿𝗲𝗻𝗰𝗲 𝗯𝗲𝘁𝘄𝗲𝗲𝗻 𝗗𝗲𝗲𝗽 𝗖𝗼𝗽𝘆 𝗮𝗻𝗱 𝗦𝗵𝗮𝗹𝗹𝗼𝘄 𝗖𝗼𝗽𝘆? - A shallow copy duplicates only the top-level structure; nested objects still reference the original - Object.assign() and spread syntax { ...obj } create shallow copies - A deep copy duplicates the entire structure, including nested objects If you can clearly explain these concepts with examples, you are already ahead of many candidates. 𝗠𝘆 𝗴𝗼𝘁𝗼 𝗿𝗲𝘀𝗼𝘂𝗿𝗰𝗲 𝗳𝗼𝗿 𝗳𝗿𝗼𝗻𝘁𝗲𝗻𝗱 𝗶𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄𝘀: https://lnkd.in/drav_5WC
To view or add a comment, sign in
-
#JavaScript Interview Prep: Debounce, Throttle ,Promise.all & Promise.race Implementation #Implementaion of Promise.all ******************************* Promise.all is used to run multiple promises at the same time and wait for all of them to finish. If all promises resolve → it returns an array of results If any promise rejects → it immediately rejects function promiseHandler(promises){ return new Promise((resolve,reject)=>{ let result=[]; let count=0; promises.forEach((promise,index)=>{ promise.then(value=>{ result[index]=value; count++; if(count===promises.length){ resolve(result) } }).catch(reject); }) }) } // create different promise to pass in function now let p1=Promise.resolve(20); let p2=Promise.resolve(30); let p3=new Promise((resolve,reject)=>{ setTimeout(function() { resolve('hello') }, 1000); }); //use created promise and pass as input in the promiseHandler function promiseHandler([p1,p2,p3]).then(result=>{ console.log('all promises handled',result) }).catch(error=>{ console.log('error in handling promises',error) }) ****#Promise.race implementation******** It returns the result of the first promise that settles (resolve or reject). function promiseRaceHandler(promises){ return new Promise((resolve,reject)=>{ promises.forEach(promise=>{ promise.then(resolve).catch(reject) }) }) } let p1=new Promise((resolve,reject)=>{ setTimeout(function() { resolve('promise1 resolved') }, 1000); }); let p2=new Promise((resolve,reject)=>{ setTimeout(function() { resolve('promise1 resolved') }, 1000); }); let p3=Promise.resolve('promise3 resolved'); promiseRaceHandler([p1,p2,p3]).then(data=>{ console.log('resolved with',data); }).catch(error=>{ console.log('error',error) }) ************#Implementation of debounce** Debounce delays the execution of a function until a specified time has passed since the last event occurred. Example: In a search box, the API call should only happen after the user stops typing, not on every keystroke. function debounce(fun, delay) { let timer; return function () { clearTimeout(timer); timer = setTimeout(fun, delay); }; } function searchData(){ console.log("Searching data... please wait"); } const debounceSearch = debounce(searchData, 500); debounceSearch(); ***************#Throttle*************** Concept to allow a function to trigger once in a specified time interval even if it is triggered many times by the user function throttle(fun, delay) { let lastCall = 0; return function () { let now = Date.now(); if (now - lastCall >= delay) { lastCall = now; fun(); } }; } function clickButton() { console.log("button is clicked..."); } const throttledClick = throttle(clickButton, 2000); throttledClick();
To view or add a comment, sign in
-
You don’t need a million-user product on your resume to clear a #React interview. If you’ve built even a small app — managed state, passed props, handled clicks, or used a couple of hooks — you already have the foundation recruiters are looking for. What really matters? Clear concepts. Clean thinking. Confident explanations. Here’s a fresh roadmap of topics interviewers love to explore 👇 🔹 Foundation Round Start strong with the core ideas: What problem does React solve? How does component-based architecture work? Difference between class components and modern functional components Understanding props vs local state JSX and why it exists How the Virtual DOM improves performance Why “key” is important while rendering lists Handling user interactions Default values for props Showing UI conditionally If you can explain these with small examples, you’re already ahead of many candidates. 🔹 Concept + Application Round This is where depth starts showing: useState and useEffect — lifecycle in functional components Controlled vs uncontrolled form elements Client-side routing using React Router Context API compared to Redux (when to use what) Prop drilling and cleaner alternatives React.memo and preventing unnecessary re-renders useMemo vs useCallback (real difference, not textbook definition) Higher-Order Components Form handling patterns in real apps Interviewers want to see: Can you build maintainable apps? 🔹 Advanced Understanding Round This is where senior-level clarity shines: Why components re-render and how to optimize Reconciliation process How the diffing algorithm works Code splitting with React.lazy and Suspense Error Boundaries Authentication flows and protected routes Render Props vs HOCs Server-Side Rendering vs Client-Side Rendering React Fiber & concurrent rendering Testing React components effectively You don’t need to memorize everything. But you should understand why React behaves the way it does. 💡 Pro Tip: Don’t just read answers. Build tiny demos. Break things. Fix them. That’s how concepts stick. Keep improving. Keep shipping projects. Your consistency will do more than any crash course ever will. 🚀 If you’re navigating your tech journey and feel stuck, you’re not alone. Ask questions. Grow publicly. Stay curious. Also, I and Ribhu Mukherjee have authored in depth 0 to DREAM placement book, from our experience with expert video resources. Check it out here: https://lnkd.in/gJtXjkBP #ReactJS #FrontendDeveloper #WebDevelopment #JavaScript #TechCareers #CodingInterview #SoftwareEngineering
To view or add a comment, sign in
-
-
🚀 30 Advanced Frontend Interview Questions Every Developer Should Know (2026 Edition) If you're preparing for Frontend / MERN Stack interviews, these advanced-level questions can help you test your real understanding of modern web development. Whether you're a fresher, job seeker, or experienced developer, mastering these topics will make you stand out during technical interviews. Here are 30 Advanced Frontend Interview Questions 👇 1️⃣ What is the difference between Virtual DOM and Real DOM, and how does it improve performance? 2️⃣ Explain Reconciliation in React. How does the diffing algorithm work? 3️⃣ What are React Fiber and Concurrent Rendering? 4️⃣ What is Hydration in React and why is it important for SSR? 5️⃣ Difference between Server-Side Rendering (SSR), Static Site Generation (SSG), and CSR. 6️⃣ What are Higher Order Components (HOC) and when should they be used? 7️⃣ Explain React Hooks rules and why they exist. 8️⃣ What is the difference between useMemo, useCallback, and React.memo? 9️⃣ How does Code Splitting improve performance in large applications? 🔟 What are Web Workers and when should they be used? 11️⃣ Explain Event Delegation in JavaScript with a real example. 12️⃣ What is Debouncing vs Throttling and when should each be used? 13️⃣ How does JavaScript Event Loop work in the browser? 14️⃣ What is the difference between Microtasks and Macrotasks? 15️⃣ Explain Closures and their practical use in frontend applications. 16️⃣ What are Critical Rendering Path and Render Blocking Resources? 17️⃣ How can you optimize website performance for large applications? 18️⃣ What is Tree Shaking in JavaScript bundlers? 19️⃣ What is the difference between Shadow DOM and Virtual DOM? 20️⃣ What are Progressive Web Apps (PWA) and their benefits? 21️⃣ How does Lazy Loading of images/components work? 22️⃣ What is Content Security Policy (CSP) in frontend security? 23️⃣ Explain Cross-Origin Resource Sharing (CORS). 24️⃣ What is the difference between Authentication and Authorization in frontend apps? 25️⃣ What are Service Workers and how do they enable offline apps? 26️⃣ Explain state management patterns in large React apps. 27️⃣ What is the difference between Redux, Context API, and Zustand? 28️⃣ What are design patterns commonly used in frontend architecture? 29️⃣ How do you handle memory leaks in React applications? 30️⃣ What are Web Vitals (LCP, CLS, INP) and how do they impact performance? 🔥 Follow for more Frontend, MERN, and Developer Interview content. #frontenddeveloper #frontenddevelopment #mernstack #reactjs #javascript #webdevelopment #codinginterview #softwaredeveloper #developercommunity #techcareer #programming #learncoding #webdev #developerlife #softwareengineering #reactdeveloper #javascriptdeveloper #mernstackdeveloper #techjobs #fresherjobs #hiringdevelopers #jobseekers #codingquestions #interviewpreparation #csstudents #codinglife #100daysofcode
To view or add a comment, sign in
Explore related topics
- Advanced React Interview Questions for Developers
- Backend Developer Interview Questions for IT Companies
- Front-end Development with React
- Techniques For Optimizing Frontend Performance
- Key Skills for Backend Developer Interviews
- How to Prepare for UX Career Development Interviews
- Key Interview Questions to Ask About the Role
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
Keep sharing