Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: <ol> = Ordered List (numbered) <ul> = Unordered List (bulleted) <dl> = Description List (term–definition pairs) Example: <ol> <li>HTML</li> <li>CSS</li> </…
Short answer: Returns the type of a variable. Example: typeof "hello"; // "string" typeof 42; // "number" Example code Returns the type of a variable. Example: typeof "hello"; // &…
Short answer: Via CDN: <link href=" p.min.css" rel="stylesheet"> Or via NPM: npm install bootstrap Intermediate Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetc…
Short answer: Instead of attaching listeners to every element, attach one listener to a parent — it captures events from its children using bubbling. Example code document.querySelector('#list').addEventListener('click',…
Short answer: Generators are special functions that can pause and resume execution using the function* syntax and yield. Example: function* counter() { yield 1; yield 2; } const gen = counter(); console.log(gen.next().va…
Short answer: Objects store data in key-value pairs. Example: const user = { name: "Alice", age: 25 }; console.log(user.name); // Alice Example code Objects store data in key-value pairs. Example: const user =…
Short answer: == : Equality operator (converts type before comparing) === : Strict equality (no type conversion, checks type + value) Example: 5 == '5'; // true 5 === '5'; // false Example code == : Equality operator (co…
Short answer: contain tells the browser which aspects of an element’s rendering are independent from the rest of the document — reducing reflows and repaints. Example code .card { Follow me on LinkedIn: contain: layout p…
Short answer: Set equal height and width and use border-radius: 50%. Example code .circle { width: 100px; height: 100px; background: teal; border-radius: 50%; } Key Takeaway: Equal dimensions + border-radius: 50% = perfe…
Short answer: It completely hides the element — it’s not visible and doesn’t take up space in the layout. Example code .hidden { display: none; } Key Takeaway: display: none removes the element from the document flow. Re…
Short answer: Use the W3C HTML Validator to check your markup. To fix errors: Close all tags properly. Avoid duplicate ids. Ensure attributes are correctly formatted. Use only valid HTML elements. Example code ✅ Correct:…
Short answer: id is unique and used for a single element. class can be used for multiple elements. Example code <div id="main-header"></div> <div class="card"></div> <div cl…
Short answer: The <meta> tag provides metadata — like page description, author, and viewport settings. Example code <meta name="description" content="Learn web development with real examples."…
Short answer: Currying transforms a function that takes multiple arguments into a sequence of functions that take one argument each. Example: function add(a) { return b => a + b; Example code } console.log(add(5)(3));…
Short answer: .container: Fixed width, adjusts at each breakpoint. .container-fluid: Always spans 100% width. Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, mod…
Short answer: const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2…
Short answer: Logical properties adapt layouts for different writing directions (LTR, RTL, vertical text). Physical Logical margin-le ft margin-inline-s tart padding-t op padding-block-s tart Example code p { padding-inl…
Short answer: @keyframes define the steps of an animation over time. Example code @keyframes moveBox { 0% { left: 0; } 100% { left: 200px; } } .box { position: relative; animation: moveBox 2s linear infinite; } Follow me…
Short answer: Use visibility: hidden; Example code .invisible { visibility: hidden; } Follow me on LinkedIn: Key Takeaway: Hidden = invisible but occupies space. display: none = gone completely. Real-world example (ShopN…
Short answer: The <template> tag defines reusable HTML that isn’t rendered until you activate it via JavaScript. Explain a bit more Example: <template id="card-template"> <div class="card&qu…
Short answer: <iframe> embeds another HTML page inside the current page. Example code <iframe src=" width="500" height="300"></iframe> Key Takeaway: Use iframes to display exter…
Short answer: Use <table>, <tr> (row), <th> (header cell), and <td> (data cell). Example code <table border="1"> <tr> <th>Name</th> <th>Role</th> <…
Short answer: A function is a block of reusable code that performs a task or returns a value. Example: function greet(name) { return `Hello, ${name}!`; } console.log(greet("Sandeep")); Example code A function i…
Short answer: Cards are flexible content containers for images, text, and links. <div class="card" style="width:18rem;"> <img src="..." class="card-img-top"> <div cl…
Short answer: Both create objects, but: {} is simpler and faster. new Object() is less common and can be overridden. Example: const a = {}; // Preferred const b = new Object(); // Not preferred Example code Both create o…
JavaScript JavaScript Tutorial · JavaScript
Short answer: <ol> = Ordered List (numbered) <ul> = Unordered List (bulleted) <dl> = Description List (term–definition pairs) Example: <ol> <li>HTML</li> <li>CSS</li> </ol> <ul> <li>Apple</li> <li>Banana</li> </ul> Follow me on LinkedIn: <dl> <dt>HTML</dt> <dd>HyperText Markup Language</dd> </dl> Key Takeaway: Choose list type based on how you want to present data.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Returns the type of a variable. Example: typeof "hello"; // "string" typeof 42; // "number"
Returns the type of a variable. Example: typeof "hello"; // "string" typeof 42; // "number"
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Via CDN: <link href=" p.min.css" rel="stylesheet"> Or via NPM: npm install bootstrap Intermediate
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Instead of attaching listeners to every element, attach one listener to a parent — it captures events from its children using bubbling.
document.querySelector('#list').addEventListener('click', e => { if (e.target.tagName === 'LI') console.log(e.target.textContent); }); Follow me on LinkedIn: ✅ Improves performance and memory usage.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Generators are special functions that can pause and resume execution using the function* syntax and yield. Example: function* counter() { yield 1; yield 2; } const gen = counter(); console.log(gen.next().value); // 1
Generators are special functions that can pause and resume execution using the function* syntax and yield. Example: function* counter() { yield 1; yield 2; }
const gen = counter(); console.log(gen.next().value); // 1
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Objects store data in key-value pairs. Example: const user = { name: "Alice", age: 25 }; console.log(user.name); // Alice
Objects store data in key-value pairs. Example: const user = { name: "Alice", age: 25 }; console.log(user.name); // Alice
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: == : Equality operator (converts type before comparing) === : Strict equality (no type conversion, checks type + value) Example: 5 == '5'; // true 5 === '5'; // false
== : Equality operator (converts type before comparing) === : Strict equality (no type conversion, checks type + value) Example: 5 == '5'; // true
5 === '5'; // false
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: contain tells the browser which aspects of an element’s rendering are independent from the rest of the document — reducing reflows and repaints.
.card { Follow me on LinkedIn: contain: layout paint; } Key Takeaway: Containment isolates elements for performance optimization.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Set equal height and width and use border-radius: 50%.
.circle { width: 100px; height: 100px; background: teal; border-radius: 50%; } Key Takeaway: Equal dimensions + border-radius: 50% = perfect circle.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: It completely hides the element — it’s not visible and doesn’t take up space in the layout.
.hidden { display: none; } Key Takeaway: display: none removes the element from the document flow.
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 W3C HTML Validator to check your markup. To fix errors: Close all tags properly. Avoid duplicate ids. Ensure attributes are correctly formatted. Use only valid HTML elements.
✅ Correct: <img src="logo.png" alt="Company Logo"> ❌ Incorrect: <img src="logo.png" alt=Company Logo> Follow me on LinkedIn: Key Takeaway: Clean, valid HTML ensures better rendering, SEO, and accessibility.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: id is unique and used for a single element. class can be used for multiple elements.
<div id="main-header"></div> <div class="card"></div> <div class="card"></div> Key Takeaway: Use id for specific targeting; class for grouping and styling.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: The <meta> tag provides metadata — like page description, author, and viewport settings.
<meta name="description" content="Learn web development with real examples."> <meta name="viewport" content="width=device-width, initial-scale=1.0"> Key Takeaway: Meta tags are essential for SEO and responsive design.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Currying transforms a function that takes multiple arguments into a sequence of functions that take one argument each. Example: function add(a) { return b => a + b;
} console.log(add(5)(3)); // 8 ✅ Useful for function reusability and functional composition.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: .container: Fixed width, adjusts at each breakpoint. .container-fluid: Always spans 100% width.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2,…
const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3); const arr1 = [1, 2, 3]; const arr2 = new Array(1, 2, 3);
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Logical properties adapt layouts for different writing directions (LTR, RTL, vertical text). Physical Logical margin-le ft margin-inline-s tart padding-t op padding-block-s tart
p { padding-inline-start: 10px; /* Works for both LTR and RTL */ } Key Takeaway: Logical properties make designs multilingual and direction-aware.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: @keyframes define the steps of an animation over time.
@keyframes moveBox { 0% { left: 0; } 100% { left: 200px; } } .box { position: relative; animation: moveBox 2s linear infinite; } Follow me on LinkedIn: Key Takeaway: Keyframes control how elements move, rotate, or fade during animation.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Use visibility: hidden;
.invisible { visibility: hidden; } Follow me on LinkedIn: Key Takeaway: Hidden = invisible but occupies space. display: none = gone completely.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: The <template> tag defines reusable HTML that isn’t rendered until you activate it via JavaScript.
Example: <template id="card-template"> <div class="card"> <h3></h3> <p></p> </div> </template> <script> const tmpl = document.getElementById("card-template"); clone.querySelector("p").textContent = "Use semantic tags for SEO."; document.body.appendChild(clone); </script> Key Takeaway: <template> = invisible HTML blueprint ready to be cloned dynamically.
const clone = tmpl.content.cloneNode(true);
clone.querySelector("h3").textContent = "HTML Tips";
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: <iframe> embeds another HTML page inside the current page.
<iframe src=" width="500" height="300"></iframe> Key Takeaway: Use iframes to display external content, but avoid excessive use for performance and SEO reasons. 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: Use <table>, <tr> (row), <th> (header cell), and <td> (data cell).
<table border="1"> <tr> <th>Name</th> <th>Role</th> </tr> <tr> <td>Sandeep</td> Follow me on LinkedIn: <td>Developer</td> </tr> </table> Key Takeaway: Tables are for data — not for layout.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: A function is a block of reusable code that performs a task or returns a value. Example: function greet(name) { return `Hello, ${name}!`; } console.log(greet("Sandeep"));
A function is a block of reusable code that performs a task or returns a value. Example: function greet(name) { return `Hello, ${name}!`;
} console.log(greet("Sandeep"));
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Cards are flexible content containers for images, text, and links. <div class="card" style="width:18rem;"> <img src="..." class="card-img-top"> <div class="card-body">...</div> </div> 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 create objects, but: {} is simpler and faster. new Object() is less common and can be overridden. Example: const a = {}; // Preferred const b = new Object(); // Not preferred
Both create objects, but: {} is simpler and faster. new Object() is less common and can be overridden. Example: const a = {}; // Preferred
const b = new Object(); // Not preferred
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.