Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: Follow me on LinkedIn: Bootstrap is a popular front-end framework for building responsive, mobile-first web pages using HTML, CSS, and JavaScript components. Real-world example (ShopNest) ShopNest’s browser…
Short answer: They are part of the browser’s rendering process when the DOM or styles change. Explain a bit more Reflow (Layout): Happens when the structure or geometry of the page changes (like changing size, position,…
Short answer: block elements take full width and start on a new line. inline-block behaves like inline (stays in the same line) but allows setting width, height, margin, and padding. Example code .block { display: block;…
Short answer: JavaScript is a high-level, interpreted programming language primarily used for web development to make webpages interactive. Example: alert('Hello World!'); Example code JavaScript is a high-level, interpr…
Short answer: The event loop manages asynchronous operations in JavaScript. It continuously checks the call stack and callback queue — executing queued tasks once the stack is empty. Example code console.log("A"…
Short answer: Flexbox (Flexible Box Layout) is a one-dimensional layout system for aligning items horizontally or vertically. Example code .container { display: flex; justify-content: center; align-items: center; } Why u…
Short answer: The <!DOCTYPE html> declaration tells the browser which version of HTML the page uses. In modern websites, it triggers HTML5 standards mode, ensuring consistent rendering across browsers. Example: <…
Short answer: lignment Easier for single direction Easier for full layout structure /* Flexbox */ display: flex; /* Grid */ Follow me on LinkedIn: display: grid; grid-template-columns: repeat(3, 1fr); Key Takeaway: Use F…
Short answer: Feature Bootstrap 4 Bootstrap 5 jQuery Required Removed Grid 5 breakpoints 6 (added xxl) Forms Legacy Redesigned Icons None Separate Bootstrap Icons Utility API Limited Expanded and customizable Real-world…
Short answer: Garbage collection automatically frees memory that’s no longer referenced. The V8 engine uses the mark-and-sweep algorithm: “Mark” reachable objects from the root. “Sweep” and delete unreachable ones. Examp…
Short answer: Feature Flexbox Grid Layout One-dimensional (row or column) Two-dimensional (rows and columns) Use Case Aligning items in a line Building full-page layouts Alignment Easier for single direction Easier for f…
Short answer: Example: <user-card></user-card> <template id="user-template"> <p>Hello, <span id="name"></span></p> </template> <script> class User…
Short answer: The Shadow DOM is a web component feature that encapsulates a section of the DOM — meaning styles and markup inside it don’t leak out or get affected by the rest of the page. Example: <custom-card><…
Short answer: The <canvas> element is used to draw graphics, animations, charts, or games using JavaScript. Example: <canvas id="myCanvas" width="200" height="100"></canvas>…
Short answer: pply () Same as call(), but takes array Array ✅ Yes bind( Returns a new function with fixed this Comma-separat ed ❌ No function greet(greeting) { console.log(`${greeting}, ${this.name}`); } const user = { n…
Short answer: A container wraps page content and provides horizontal padding. <div class="container">Content</div> <div class="container-fluid">Full width</div> Real-world exam…
Short answer: A service worker is a background script that runs independently of the web page. It enables offline caching, push notifications, and background sync. Example code navigator.serviceWorker.register('/sw.js');…
Short answer: Metho Purpose Arguments Invokes Immediately? call( Call a function with a specific this Comma-separat ed ✅ Yes apply () Same as call(), but takes array Array ✅ Yes bind( Returns a new function with fixed th…
Short answer: Type Scope Example Priority Inline Single element style="color:re d;" Highest Internal One page <style> inside <head> Medium External Multiple pages Linked .css file Lowest Key Takeawa…
Short answer: Both store data in the browser, but they differ in duration and scope. Feature localStorage sessionStorage Lifetime Until manually cleared Until the tab is closed Scope Shared across tabs Specific to one ta…
Short answer: <div> is a block-level element (creates a full-width container). <span> is an inline element (used for styling small text portions). Example code <div>Block Section</div> <p>Th…
Short answer: In JavaScript, every object can inherit properties from another object called its prototype. This enables object reusability. Example: const animal = { eats: true }; Example code const dog = Object.create(a…
Short answer: Follow me on LinkedIn: Aspect @import <link> Loaded Inside CSS Inside HTML <head> Performance Slower (sequential) Faster (parallel) Media Queries Can include Can include Recommended ❌ Avoid ✅ Pr…
Short answer: Every HTML element is a box made of: Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling. Say this in the interview D…
Short answer: Lazy loading defers loading of non-critical images or iframes until they are visible in the viewport — improving page speed. Example code <img src="photo.jpg" loading="lazy" alt="…
JavaScript JavaScript Tutorial · JavaScript
Short answer: Follow me on LinkedIn: Bootstrap is a popular front-end framework for building responsive, mobile-first web pages using HTML, CSS, and JavaScript components.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: They are part of the browser’s rendering process when the DOM or styles change.
Reflow (Layout): Happens when the structure or geometry of the page changes (like changing size, position, or adding elements). → Expensive operation since it recalculates layout. Follow me on LinkedIn: Repaint: Happens when visual appearance (like color or background) changes without affecting layout. Example: div.style.width = "200px"; /* triggers reflow + repaint */
div.style.background = "red"; /* triggers repaint only */ Key Takeaway: Minimize layout changes; batch DOM updates to improve performance.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: block elements take full width and start on a new line. inline-block behaves like inline (stays in the same line) but allows setting width, height, margin, and padding.
.block { display: block; width: 100px; } .inline-block { display: inline-block; width: 100px; } Key Takeaway: inline-block combines the flow of inline with the flexibility of block. Follow me on LinkedIn:
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: JavaScript is a high-level, interpreted programming language primarily used for web development to make webpages interactive. Example: alert('Hello World!');
JavaScript is a high-level, interpreted programming language primarily used for web development to make webpages interactive. Example: alert('Hello World!');
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: The event loop manages asynchronous operations in JavaScript. It continuously checks the call stack and callback queue — executing queued tasks once the stack is empty.
console.log("A"); setTimeout(() => console.log("B"), 0); console.log("C"); // Output: A, C, B Even though setTimeout is 0ms, it runs after the main thread finishes due to the event loop.
The checkout button uses async/await to call /api/orders, shows a spinner, and catches network errors with a toast.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Flexbox (Flexible Box Layout) is a one-dimensional layout system for aligning items horizontally or vertically.
.container { display: flex; justify-content: center; align-items: center; } Why use it: Centers elements easily. Handles spacing and alignment dynamically. Makes layouts responsive. Key Takeaway: Flexbox simplifies alignment and space distribution in one direction.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: The <!DOCTYPE html> declaration tells the browser which version of HTML the page uses. In modern websites, it triggers HTML5 standards mode, ensuring consistent rendering across browsers. Example: <!DOCTYPE html> <html> ... </html> Key Takeaway: Always include <!DOCTYPE html> at the top of every HTML file.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: lignment Easier for single direction Easier for full layout structure /* Flexbox */ display: flex; /* Grid */ Follow me on LinkedIn: display: grid; grid-template-columns: repeat(3, 1fr); Key Takeaway: Use Flexbox for alignment; Grid for complete layouts. lignment Easier for single direction Easier for full layout structure
/* Flexbox */ display: flex; /* Grid */ Follow me on LinkedIn: display: grid; grid-template-columns: repeat(3, 1fr); Key Takeaway: Use Flexbox for alignment; Grid for complete layouts. lignment Easier for single direction Easier for full layout structure Example: /* Flexbox */ display: flex; /* Grid */ Follow me on LinkedIn: display: grid; grid-template-columns: repeat(3, 1fr); Key Takeaway: Use Flexbox for alignment; Grid for complete layouts.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Feature Bootstrap 4 Bootstrap 5 jQuery Required Removed Grid 5 breakpoints 6 (added xxl) Forms Legacy Redesigned Icons None Separate Bootstrap Icons Utility API Limited Expanded and customizable
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Garbage collection automatically frees memory that’s no longer referenced. The V8 engine uses the mark-and-sweep algorithm: “Mark” reachable objects from the root. “Sweep” and delete unreachable ones. Example: let user = { name: "John" };
user = null; // eligible for garbage collection
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Feature Flexbox Grid Layout One-dimensional (row or column) Two-dimensional (rows and columns) Use Case Aligning items in a line Building full-page layouts Alignment Easier for single direction Easier for full layout structure
/* Flexbox */ display: flex; /* Grid */ Follow me on LinkedIn: display: grid; grid-template-columns: repeat(3, 1fr); Key Takeaway: Use Flexbox for alignment; Grid for complete layouts.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Example: <user-card></user-card> <template id="user-template"> <p>Hello, <span id="name"></span></p> </template> <script> class UserCard extends HTMLElement { connectedCallback() { const tmpl = document.getElementById("user-template");
const content = tmpl.content.cloneNode(true);
content.querySelector("#name").textContent = "Sandeep"; this.appendChild(content); }
} customElements.define("user-card", UserCard); </script> Key Takeaway: Web Components = reusable, encapsulated building blocks for modern web apps.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: The Shadow DOM is a web component feature that encapsulates a section of the DOM — meaning styles and markup inside it don’t leak out or get affected by the rest of the page. Example: <custom-card></custom-card> <script> class CustomCard extends HTMLElement { constructor() { super(); const shadow = this.attachShadow({ mode: 'open' });
shadow.innerHTML = `<style>p { color: blue; }</style><p>Hello Shadow!</p>`; }
} customElements.define('custom-card', CustomCard); </script> Key Takeaway: Shadow DOM = style and structure isolation for reusable, predictable components.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: The <canvas> element is used to draw graphics, animations, charts, or games using JavaScript. Example: <canvas id="myCanvas" width="200" height="100"></canvas> <script> const canvas = document.getElementById("myCanvas"); ctx.fillStyle = "blue"; ctx.fillRect(10, 10, 180, 80); </script> Follow me on LinkedIn: Key Takeaway: <canvas> gives you a pixel-based drawing area inside HTML — perfect for dynamic graphics.
const ctx = canvas.getContext("2d");
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: pply () Same as call(), but takes array Array ✅ Yes bind( Returns a new function with fixed this Comma-separat ed ❌ No function greet(greeting) { console.log(`${greeting}, ${this.name}`); } const user = { name: "John" }; greet.call(user, "Hi"); greet.apply(user, ["Hello"]); const bound = greet.bind(user, "Hey"); bound(); … pply () Same as call(),… but takes array Array ✅ Yes bind( Returns a new function with fixed…
function greet(greeting) { console.log(`${greeting}, ${this.name}`); } const user = { name: "John" }; greet.call(user, "Hi"); greet.apply(user, ["Hello"]); const bound = greet.bind(user, "Hey"); bound(); pply () Same as call(), but takes array Array ✅ Yes bind( Returns a new function with fixed this Comma-separat ed ❌ No Example: function greet(greeting) { console.log(`${greeting}, ${this.name}`); } const user = { name: "John" }; greet.call(user, "Hi"); greet.apply(user, ["Hello"]); const bound = greet.bind(user, "Hey"); bound(); … pply () Same as call(), but takes array Array ✅ Yes bind( Returns a new function with fixed this Comma-separat ed ❌ No Example: function greet(greeting) { console.log(`${greeting}, ${this.name}`); } const user = { name: "John" }; greet.call(user, "Hi"); greet.apply(user, ["Hello"]); const bound = greet.bind(user, "Hey"); bound();
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: A container wraps page content and provides horizontal padding. <div class="container">Content</div> <div class="container-fluid">Full width</div>
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: A service worker is a background script that runs independently of the web page. It enables offline caching, push notifications, and background sync.
navigator.serviceWorker.register('/sw.js'); ✅ Used in Progressive Web Apps (PWAs).
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Metho Purpose Arguments Invokes Immediately? call( Call a function with a specific this Comma-separat ed ✅ Yes apply () Same as call(), but takes array Array ✅ Yes bind( Returns a new function with fixed this Comma-separat ed ❌ No Example: function greet(greeting) { console.log(`${greeting}, ${this.name}`); }
const user = { name: "John" }; greet.call(user, "Hi"); greet.apply(user, ["Hello"]); const bound = greet.bind(user, "Hey"); bound();
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Type Scope Example Priority Inline Single element style="color:re d;" Highest Internal One page <style> inside <head> Medium External Multiple pages Linked .css file Lowest Key Takeaway: Use external CSS for maintainable, large-scale projects. Follow me on LinkedIn:
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Both store data in the browser, but they differ in duration and scope. Feature localStorage sessionStorage Lifetime Until manually cleared Until the tab is closed Scope Shared across tabs Specific to one tab Capacity ~5–10MB ~5MB
localStorage.setItem("username", "Sandeep"); sessionStorage.setItem("theme", "dark"); Key Takeaway: Use localStorage for long-term data; sessionStorage for temporary, tab-specific data.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: <div> is a block-level element (creates a full-width container). <span> is an inline element (used for styling small text portions).
<div>Block Section</div> <p>This is a <span style="color: red;">red word</span> in a sentence.</p> Key Takeaway: Use <div> for layout; <span> for inline styling.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: In JavaScript, every object can inherit properties from another object called its prototype. This enables object reusability. Example: const animal = { eats: true };
const dog = Object.create(animal); Follow me on LinkedIn: dog.barks = true; console.log(dog.eats); // true (inherited)
Prefer arrow functions for React/event callbacks in ShopNest so this is not accidentally rebound.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Follow me on LinkedIn: Aspect @import <link> Loaded Inside CSS Inside HTML <head> Performance Slower (sequential) Faster (parallel) Media Queries Can include Can include Recommended ❌ Avoid ✅ Preferred Key Takeaway: Use <link> — it loads faster and supports preloading and caching better.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Every HTML element is a box made of:
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Lazy loading defers loading of non-critical images or iframes until they are visible in the viewport — improving page speed.
<img src="photo.jpg" loading="lazy" alt="Nature view"> Key Takeaway: loading="lazy" helps reduce initial load time and saves bandwidth.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
Install Toolliyo like an app Free
Home-screen access to tutorials, coding practice & career tools — no app store needed.
On iPhone/iPad: tap Share then Add to Home Screen.