Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: An event listener waits for user actions (like clicks or keypresses) and runs a function when the event occurs. Example code button.addEventListener("click", () => alert("Clicked!"));…
Short answer: Controls what happens when content exceeds the container’s size. Values: visible (default) hidden scroll auto Example code div { overflow: auto; } Key Takeaway: overflow: auto adds scrollbars only when need…
Short answer: It collects user input and sends it to a server or script for processing. Example code <form action="/submit" method="POST"> <input type="text" name="username&quo…
Short answer: Variables declared inside a function are accessible only within that function. Example code function demo() { let x = 10; console.log(x); // 10 } console.log(x); // ReferenceError Real-world example (ShopNe…
Short answer: ssigned Follow me on LinkedIn: 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 Define…
Short answer: Type Meaning null Intentional absence of value undefin ed Variable declared but not assigned Follow me on LinkedIn: Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs w…
Short answer: Property Location Affects Background? Padding Inside border ✅ Yes Margin Outside border ❌ No Example code div { Follow me on LinkedIn: margin: 10px; padding: 20px; } Key Takeaway: Padding = inner spacing, M…
Short answer: <picture> allows serving different image versions depending on device, screen size, or media type. Example code <picture> <source srcset="photo-large.jpg" media="(min-width: 80…
Short answer: <head> holds metadata (title, styles, scripts). <header> defines the visible top section of the page (logo, navigation, heading). Example code <head> <title>My Portfolio</title>…
Short answer: Variables declared with let or const inside curly braces {} are accessible only within that block. Example: if (true) { let y = 20; const z = 30; } // console.log(y, z); // ReferenceError Example code Varia…
Short answer: Follow me on LinkedIn: Debouncing: Executes a function after a delay of no activity. Throttling: Executes a function at regular intervals. Example (debounce): function debounce(fn, delay) { let timer; retur…
Short answer: Static typing: Variable types are known at compile-time (e.g., TypeScript, Java). Dynamic typing: Types are determined at runtime (JavaScript). Example: let x = 10; // number Example code x = "text&quo…
Short answer: NaN stands for “Not-a-Number”, representing an invalid numeric operation. Example: console.log("hello" / 2); // NaN Example code NaN stands for “Not-a-Number”, representing an invalid numeric oper…
Short answer: Defines how images or videos resize within their container. Follow me on LinkedIn: Example code img { width: 100%; height: 300px; object-fit: cover; } Key Takeaway: cover fills the box; contain fits the who…
Short answer: Call stack: Where function execution happens (synchronous). Task queue: Holds async callbacks (processed after stack is empty). Example code console.log("1"); setTimeout(() => console.log("…
Short answer: Used to find the type of a variable. typeof "Hello"; // "string" typeof 10; // "number" typeof null; // "object" (bug) Example code Used to find the type of a variabl…
Short answer: Targets elements with a specific class attribute. Example code .card { background-color: lightgray; } <div class="card">Profile</div> Follow me on LinkedIn: Key Takeaway: Classes are r…
Short answer: When an event occurs in a nested element: Bubbling: Event moves upward (child → parent). Capturing: Event moves downward (parent → child). Example code element.addEventListener('click', handler, true); // c…
Short answer: Feature Regular Function Arrow Function this Dynamic Lexical (inherits from parent) Syntax function f(){} (a,b)=>a+b Can be used as constructor ✅ ❌ Example code Feature Regular Function Arrow Function th…
Short answer: A style where functions are pure, stateless, and composable. Example: const double = x => x * 2; const square = x => x * x; const result = square(double(3)); // 36 Example code A style where functions…
Short answer: Type Description Shallow Copy Copies top-level properties only Deep Copy Copies all nested objects too Follow me on LinkedIn: Example: const obj = { a: { b: 1 } }; Example code const shallow = { ...obj }; /…
Short answer: Unit Relative To Example em Parent’s font size 2em = 2 × parent font-size rem Root (<html>) font size 2rem = 2 × root font-size Example code html { font-size: 16px; } p { font-size: 2rem; } /* = 32px…
Short answer: The alt attribute provides alternative text when an image fails to load and is read by screen readers. Example code Follow me on LinkedIn: <img src="team.jpg" alt="Our development team&quo…
Short answer: A function that accepts another function as a parameter or returns a function. Example: function multiplyBy(factor) { return x => x * factor; } const double = multiplyBy(2); console.log(double(5)); // 10…
Short answer: Promise chaining allows multiple async tasks to run sequentially. Example code fetch('/data') .then(res => res.json()) .then(data => console.log(data)) .catch(err => console.error(err)); Real-world…
JavaScript JavaScript Tutorial · JavaScript
Short answer: An event listener waits for user actions (like clicks or keypresses) and runs a function when the event occurs.
button.addEventListener("click", () => alert("Clicked!"));
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Controls what happens when content exceeds the container’s size. Values: visible (default) hidden scroll auto
div { overflow: auto; } Key Takeaway: overflow: auto adds scrollbars only when needed.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: It collects user input and sends it to a server or script for processing.
<form action="/submit" method="POST"> <input type="text" name="username"> <button type="submit">Submit</button> </form> Key Takeaway: Forms are the foundation of user interaction on the web.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Variables declared inside a function are accessible only within that function.
function demo() { let x = 10; console.log(x); // 10 } console.log(x); // ReferenceError
In ShopNest’s cart UI, a click handler closes over productId. Use let in loops so each button keeps the correct id.
JavaScript JavaScript Tutorial · JavaScript
Short answer: ssigned 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: Type Meaning null Intentional absence of value undefin ed Variable declared but not assigned 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: Property Location Affects Background? Padding Inside border ✅ Yes Margin Outside border ❌ No
div { Follow me on LinkedIn: margin: 10px; padding: 20px; } Key Takeaway: Padding = inner spacing, Margin = outer spacing.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: <picture> allows serving different image versions depending on device, screen size, or media type.
<picture> <source srcset="photo-large.jpg" media="(min-width: 800px)"> <source srcset="photo-small.jpg" media="(max-width: 799px)"> <img src="photo-default.jpg" alt="Beautiful landscape"> </picture> Key Takeaway: Use <picture> for art direction — showing different images per device or context.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: <head> holds metadata (title, styles, scripts). <header> defines the visible top section of the page (logo, navigation, heading).
<head> <title>My Portfolio</title> </head> <header> <h1>Welcome to My Portfolio</h1> </header> Follow me on LinkedIn: Key Takeaway: <head> = document info; <header> = visible header area.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Variables declared with let or const inside curly braces {} are accessible only within that block. Example: if (true) { let y = 20; const z = 30; } // console.log(y, z); // ReferenceError
Variables declared with let or const inside curly braces {} are accessible only within that block. Example: if (true) {
let y = 20;
const z = 30;
} // console.log(y, z); // ReferenceError
In ShopNest’s cart UI, a click handler closes over productId. Use let in loops so each button keeps the correct id.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Follow me on LinkedIn: Debouncing: Executes a function after a delay of no activity. Throttling: Executes a function at regular intervals. Example (debounce): function debounce(fn, delay) { let timer; return (...args) => { clearTimeout(timer); timer = setTimeout(() => fn(...args), delay); }; }
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Static typing: Variable types are known at compile-time (e.g., TypeScript, Java). Dynamic typing: Types are determined at runtime (JavaScript). Example: let x = 10; // number
x = "text"; // allowed
JavaScript JavaScript Tutorial · JavaScript
Short answer: NaN stands for “Not-a-Number”, representing an invalid numeric operation. Example: console.log("hello" / 2); // NaN
NaN stands for “Not-a-Number”, representing an invalid numeric operation. Example: console.log("hello" / 2); // NaN
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Defines how images or videos resize within their container. Follow me on LinkedIn:
img { width: 100%; height: 300px; object-fit: cover; } Key Takeaway: cover fills the box; contain fits the whole image inside.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Call stack: Where function execution happens (synchronous). Task queue: Holds async callbacks (processed after stack is empty).
console.log("1"); setTimeout(() => console.log("2"), 0); console.log("3"); // Output: 1, 3, 2 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: Used to find the type of a variable. typeof "Hello"; // "string" typeof 10; // "number" typeof null; // "object" (bug)
Used to find the type of a variable. typeof "Hello"; // "string" typeof 10; // "number" typeof null; // "object" (bug)
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Targets elements with a specific class attribute.
.card { background-color: lightgray; } <div class="card">Profile</div> Follow me on LinkedIn: Key Takeaway: Classes are reusable; use them for consistent styling across elements.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: When an event occurs in a nested element: Bubbling: Event moves upward (child → parent). Capturing: Event moves downward (parent → child).
element.addEventListener('click', handler, true); // capturing element.addEventListener('click', handler, false); // bubbling
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Feature Regular Function Arrow Function this Dynamic Lexical (inherits from parent) Syntax function f(){} (a,b)=>a+b Can be used as constructor ✅ ❌
Feature Regular Function Arrow Function this Dynamic Lexical (inherits from parent) Syntax function f(){} (a,b)=>a+b Can be used as constructor ✅ ❌
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: A style where functions are pure, stateless, and composable. Example: const double = x => x * 2; const square = x => x * x; const result = square(double(3)); // 36
A style where functions are pure, stateless, and composable. Example: const double = x => x * 2;
const square = x => x * x;
const result = square(double(3)); // 36
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Type Description Shallow Copy Copies top-level properties only Deep Copy Copies all nested objects too Follow me on LinkedIn: Example: const obj = { a: { b: 1 } };
const shallow = { ...obj }; // same reference
const deep = JSON.parse(JSON.stringify(obj)); // new copy
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Unit Relative To Example em Parent’s font size 2em = 2 × parent font-size rem Root (<html>) font size 2rem = 2 × root font-size
html { font-size: 16px; } p { font-size: 2rem; } /* = 32px */ Key Takeaway: Use rem for consistent sizing across the document.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: The alt attribute provides alternative text when an image fails to load and is read by screen readers.
Follow me on LinkedIn: <img src="team.jpg" alt="Our development team"> Key Takeaway: Always include meaningful alt text — it’s good for accessibility and SEO.
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 that accepts another function as a parameter or returns a function. Example: function multiplyBy(factor) { return x => x * factor; } const double = multiplyBy(2); console.log(double(5)); // 10
A function that accepts another function as a parameter or returns a function. Example: function multiplyBy(factor) { return x => x * factor;
}
const double = multiplyBy(2); console.log(double(5)); // 10
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Promise chaining allows multiple async tasks to run sequentially.
fetch('/data') .then(res => res.json()) .then(data => console.log(data)) .catch(err => console.error(err));
The checkout button uses async/await to call /api/orders, shows a spinner, and catches network errors with a toast.
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.