Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: YouTube provides an embed link using <iframe>. Example code <iframe width="560" height="315" src=" allowfullscreen> </iframe> Key Takeaway: Always use the /embed/…
Short answer: Modals are created using the .modal class and toggled with JS or data attributes. <button data-bs-toggle="modal" data-bs-target="#myModal">Open</button> <div class="m…
Short answer: A polyfill is a piece of code that adds a feature missing in older browsers. Follow me on LinkedIn: Example code if (!Array.prototype.includes) { Array.prototype.includes = function(item) { return this.inde…
Short answer: Functions that: Return the same output for the same input. Have no side effects. Example: function add(a, b) { return a + b; // pure } Example code Functions that: Return the same output for the same input.…
Short answer: CSS Houdini is a set of APIs that let developers extend CSS by writing code that hooks directly into the CSS engine. Explain a bit more Examples: Paint API → Custom background drawing. Layout API → Define c…
Short answer: Use the following combination: p { width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } Key Takeaway: Truncates long text with “…” when it exceeds container width. Real-world exam…
Short answer: Entities display reserved characters (like <, >, &) or symbols not on the keyboard. Example code <p>Use <div> for containers and &amp; for ampersands.</p> Key Takeaway: Entit…
Short answer: Follow me on LinkedIn: Comments are added using: <!-- This is a comment --> Example: <!-- TODO: Add footer here --> Key Takeaway: Comments help others understand your code — they don’t appear on…
Short answer: Reusable UI blocks like buttons, modals, navbars, forms, alerts, etc., that Bootstrap’s design standards. Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/…
Short answer: ✅ Use CSS to improve readability and focus visibility: Follow me on LinkedIn: Maintain sufficient color contrast: body { color: #111; background: #fff; } Use :focus styles for keyboard users: button:focus {…
Short answer: Combinators define relationships between selectors. Combinator Description Example Descendant ( ) Any nested element div p Child (>) Direct child only div > Adjacent sibling (+) Immediately next eleme…
Short answer: Minimize HTML, CSS, and JS files. Use lazy loading for images. Use defer or async for scripts. Compress images and enable caching. Reduce DOM size. Example code Follow me on LinkedIn: <script src="m…
Short answer: Add the lang attribute in the <html> tag. Example code <html lang="en"> Key Takeaway: Helps screen readers and search engines understand the page’s language. Real-world example (ShopNe…
Short answer: Arrow functions are a shorter syntax for writing functions and do not have their own this. Example: const add = (a, b) => a + b; console.log(add(2, 3)); // 5 Example code Arrow functions are a shorter sy…
Short answer: Performance: Iframes load as separate browsing contexts, adding extra network requests and increasing page load time. SEO: Content inside iframes isn’t fully indexed by search engines. Links and text inside…
Short answer: Images that automatically scale with the parent container using .img-fluid: <img src="..." class="img-fluid" alt="Responsive image"> Real-world example (ShopNest) ShopNes…
Short answer: It applies visual effects (like blur, brightness, or contrast) to the area behind an element. Example code .blur-bg { backdrop-filter: blur(10px); background: rgba(255, 255, 255, 0.3); } Key Takeaway: Used…
Short answer: Selects elements based on their order within a parent. Examples: li:nth-child(2) { color: red; } /* 2nd item */ li:nth-child(odd) { background: #eee; } /* odd items */ li:nth-child(3n) { font-weight: bold;…
Short answer: They allow you to store extra data on HTML elements — useful for scripts or dynamic behavior. Example code <button data-user-id="101" data-role="admin">View Profile</button>…
Short answer: Block-level elements start on a new line and take full width (e.g., <div>, <p>, <section>). Inline elements stay within a line (e.g., <span>, <a>, <strong>). Example code…
Short answer: Override variables using SCSS. Use Bootstrap’s Theme Customizer or utility API. Or override styles in a custom CSS file. Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch A…
Short answer: Promises handle asynchronous operations. They represent a value that may be available now, later, or never. Example code let promise = new Promise((resolve, reject) => { resolve("Success!"); })…
Short answer: Use .navbar and .navbar-expand-* classes: Follow me on LinkedIn: <nav class="navbar navbar-expand-lg navbar-light bg-light"> <a class="navbar-brand" href="#">Brand&…
Short answer: Decorators modify classes or methods at runtime. Common in TypeScript and frameworks like Angular. Example (TypeScript): function log(target, key) { console.log(`${key} was called`); } Example code class Ex…
Short answer: Define a variable with --name and access it with var(). Example code :root { -main-color: #007bff; -padding: 10px; } button { background: var(--main-color); padding: var(--padding); } Follow me on LinkedIn:…
JavaScript JavaScript Tutorial · JavaScript
Short answer: YouTube provides an embed link using <iframe>.
<iframe width="560" height="315" src=" allowfullscreen> </iframe> Key Takeaway: Always use the /embed/ URL format for proper YouTube embedding.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Modals are created using the .modal class and toggled with JS or data attributes. <button data-bs-toggle="modal" data-bs-target="#myModal">Open</button> <div class="modal fade" id="myModal"> <div class="modal-dialog"><div class="modal-content">...</div></div> </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 polyfill is a piece of code that adds a feature missing in older browsers. Follow me on LinkedIn:
if (!Array.prototype.includes) { Array.prototype.includes = function(item) { return this.indexOf(item) !== -1; }; }
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Functions that: Return the same output for the same input. Have no side effects. Example: function add(a, b) { return a + b; // pure }
Functions that: Return the same output for the same input. Have no side effects. Example: function add(a, b) { return a + b; // pure
}
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: CSS Houdini is a set of APIs that let developers extend CSS by writing code that hooks directly into the CSS engine.
Examples: Paint API → Custom background drawing. Layout API → Define custom layout logic. Properties & Values API → Register custom CSS properties. Example (Paint API): registerPaint('dots', class { paint(ctx, size) { ctx.fillStyle = 'red'; ctx.arc(50, 50, 10, 0, 2 * Math.PI); ctx.fill(); } }); Key Takeaway: Houdini gives developers low-level control over how CSS works under the hood.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Use the following combination: p { width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } Key Takeaway: Truncates long text with “…” when it exceeds container width.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Entities display reserved characters (like <, >, &) or symbols not on the keyboard.
<p>Use <div> for containers and & for ampersands.</p> Key Takeaway: Entities prevent HTML from confusing symbols with code.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Follow me on LinkedIn: Comments are added using: <!-- This is a comment --> Example: <!-- TODO: Add footer here --> Key Takeaway: Comments help others understand your code — they don’t appear on the page.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Reusable UI blocks like buttons, modals, navbars, forms, alerts, etc., that Bootstrap’s design standards.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: ✅ Use CSS to improve readability and focus visibility: Follow me on LinkedIn: Maintain sufficient color contrast: body { color: #111; background: #fff; } Use :focus styles for keyboard users: button:focus { outline: 2px solid #005fcc; } ● Avoid hiding content with display: none; if screen readers need it.
Respect user preferences: @media (prefers-reduced-motion: reduce) { * { animation: none; } } Key Takeaway: Accessible CSS ensures inclusivity for all users — especially keyboard and screen-reader users.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Combinators define relationships between selectors. Combinator Description Example Descendant ( ) Any nested element div p Child (>) Direct child only div > Adjacent sibling (+) Immediately next element h1 + p General sibling (~) All next siblings h1 ~ p Key Takeaway: Combinators refine selector targeting.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Minimize HTML, CSS, and JS files. Use lazy loading for images. Use defer or async for scripts. Compress images and enable caching. Reduce DOM size.
Follow me on LinkedIn: <script src="main.js" defer></script> <img src="hero.jpg" loading="lazy" alt="Hero image"> Key Takeaway: Speed = smaller files, fewer requests, smarter loading.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Add the lang attribute in the <html> tag.
<html lang="en"> Key Takeaway: Helps screen readers and search engines understand the page’s language.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Arrow functions are a shorter syntax for writing functions and do not have their own this. Example: const add = (a, b) => a + b; console.log(add(2, 3)); // 5
Arrow functions are a shorter syntax for writing functions and do not have their own this. Example: const add = (a, b) => a + b; console.log(add(2, 3)); // 5
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Performance: Iframes load as separate browsing contexts, adding extra network requests and increasing page load time. SEO: Content inside iframes isn’t fully indexed by search engines. Links and text inside may not count toward the parent page’s SEO. Best Practice: Use iframes only when necessary (e.g., embedding maps or videos). Add title attributes for accessibility.
<iframe src=" title="Location Map"></iframe> Key Takeaway: Iframes isolate content — great for embedding, but can slow pages and weaken SEO. Follow me on LinkedIn: CSS Interview Questions
JavaScript JavaScript Tutorial · JavaScript
Short answer: Images that automatically scale with the parent container using .img-fluid: <img src="..." class="img-fluid" alt="Responsive image">
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: It applies visual effects (like blur, brightness, or contrast) to the area behind an element.
.blur-bg { backdrop-filter: blur(10px); background: rgba(255, 255, 255, 0.3); } Key Takeaway: Used for modern UI effects (like frosted glass) — supported in modern browsers only. Follow me on LinkedIn: JavaScript Interview Questions
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Selects elements based on their order within a parent. Examples: li:nth-child(2) { color: red; } /* 2nd item */ li:nth-child(odd) { background: #eee; } /* odd items */ li:nth-child(3n) { font-weight: bold; } /* every 3rd item */ Key Takeaway: nth-child() gives you precise control over repeating patterns in lists or grids. Advanced
Selects elements based on their order within a parent. Examples: li:nth-child(2) { color: red; } /* 2nd item */ li:nth-child(odd) { background: #eee; } /* odd items */ li:nth-child(3n) { font-weight: bold; } /* every 3rd item */ Key Takeaway: nth-child() gives you precise control over repeating patterns in lists or grids. Advanced
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: They allow you to store extra data on HTML elements — useful for scripts or dynamic behavior.
<button data-user-id="101" data-role="admin">View Profile</button> <script> const btn = document.querySelector("button"); console.log(btn.dataset.userId); // 101 console.log(btn.dataset.role); // admin </script> Key Takeaway: data-* attributes are perfect for embedding small pieces of custom data without affecting layout. Follow me on LinkedIn: Advanced
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Block-level elements start on a new line and take full width (e.g., <div>, <p>, <section>). Inline elements stay within a line (e.g., <span>, <a>, <strong>).
<div>Block</div> <span>Inline</span> Key Takeaway: Block = structure; Inline = styling or small content.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Override variables using SCSS. Use Bootstrap’s Theme Customizer or utility API. Or override styles in a custom CSS file.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Promises handle asynchronous operations. They represent a value that may be available now, later, or never.
let promise = new Promise((resolve, reject) => { resolve("Success!"); }); promise.then(res => console.log(res));
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: Use .navbar and .navbar-expand-* classes: Follow me on LinkedIn: <nav class="navbar navbar-expand-lg navbar-light bg-light"> <a class="navbar-brand" href="#">Brand</a> </nav>
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Decorators modify classes or methods at runtime. Common in TypeScript and frameworks like Angular. Example (TypeScript): function log(target, key) { console.log(`${key} was called`); }
class Example { @log test() {} }
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Define a variable with --name and access it with var().
:root { -main-color: #007bff; -padding: 10px; } button { background: var(--main-color); padding: var(--padding); } Follow me on LinkedIn: Key Takeaway: CSS variables make styles dynamic and reusable.
In ShopNest’s cart UI, a click handler closes over productId. Use let in loops so each button keeps the correct id.