Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Answer: 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")); What interviewers expect A clear definition…
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 What interviewers expect A clear…
Answer: An event listener waits for user actions (like clicks or keypresses) and runs a function when the event occurs. Example: button.addEventListener("click", () => alert("Clicked!")); What interviewers expect…
Answer: It defines a shape that clips (hides) parts of an element. Example: .image { clip-path: circle(50% at 50% 50%); } Key Takeaway: clip-path creates creative shapes like circles, polygons, or custom SVG paths. What…
Answer: Controls what happens when content exceeds the container’s size. Values: visible (default) hidden scroll auto Example: div { overflow: auto; } Key Takeaway: overflow: auto adds scrollbars only when needed. What i…
It collects user input and sends it to a server or script for processing. Example: <form action="/submit" method="POST"> <input type="text" name="username"> <button type="submit">Submit</button> &…
Answer: Variables declared inside a function are accessible only within that function. Example: function demo() { let x = 10; console.log(x); // 10 } console.log(x); // ReferenceError What interviewers expect A clear def…
ssigned Follow me on LinkedIn: What interviewers expect A clear definition tied to JavaScript in JavaScript projects Trade-offs (performance, maintainability, security, cost) When you would and would not use it in produc…
Answer: Type Meaning null Intentional absence of value undefin Variable declared but not assigned Follow me on LinkedIn: What interviewers expect A clear definition tied to JavaScript in JavaScript projects Trade-offs (p…
Answer: Property Location Affects Background? Padding Inside border ✅ Yes Margin Outside border ❌ No Example: div { Follow me on LinkedIn: margin: 10px; padding: 20px; } Key Takeaway: Padding = inner spacing, Margin = ou…
<picture> allows serving different image versions depending on device, screen size, or media type. Example: <picture> <source srcset="photo-large.jpg" media="(min-width: 800px)"> <source srcset="phot…
<head> holds metadata (title, styles, scripts). <header> defines the visible top section of the page (logo, navigation, heading). Example: <head> <title>My Portfolio</title> </head> &l…
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 What interviewers expect…
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 What interview…
Answer: NaN stands for “Not-a-Number”, representing an invalid numeric operation. Example: console.log("hello" / 2); // NaN What interviewers expect A clear definition tied to JavaScript in JavaScript projects Trade-offs…
Answer: Defines how images or videos resize within their container. Follow me on LinkedIn: Example: img { width: 100%; height: 300px; object-fit: cover; } Key Takeaway: cover fills the box; contain fits the whole image i…
Call stack: Where function execution happens (synchronous). Task queue: Holds async callbacks (processed after stack is empty). Example: console.log("1"); setTimeout(() => console.log("2"), 0); console.log("3"); // Ou…
Answer: Used to find the type of a variable. typeof "Hello"; // "string" typeof 10; // "number" typeof null; // "object" (bug) What interviewers expect A clear definition tied to JavaScript in JavaScript projects Trade-o…
Targets elements with a specific class attribute. Example: .card { background-color: lightgray; } <div class="card">Profile</div> Follow me on LinkedIn: Key Takeaway: Classes are reusable; use them for consis…
Answer: Feature Regular Function Arrow Function this Dynamic Lexical (inherits from parent) Syntax function f(){} (a,b)=&gt;a+b Can be used as constructor ✅ ❌ What interviewers expect A clear definition tied to JavaS…
Answer: A style where functions are pure, stateless, and composable. Example: const double = x =&gt; x * 2; const square = x =&gt; x * x; const result = square(double(3)); // 36 What interviewers expect A clear d…
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…
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: html { font-size: 16px; } p { font-size: 2rem; } /* = 32px */ Key Takeaway: U…
The alt attribute provides alternative text when an image fails to load and is read by screen readers. Example: Follow me on LinkedIn: <img src="team.jpg" alt="Our development team"> Key Takeaway: lways include mea…
Answer: function that accepts another function as a parameter or returns a function. Example: function multiplyBy(factor) { return x =&gt; x * factor; } const double = multiplyBy(2); console.log(double(5)); // 10 Wha…
JavaScript JavaScript Tutorial · JavaScript
Answer: 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"));
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
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
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
Answer: An event listener waits for user actions (like clicks or keypresses) and runs a function when the event occurs. Example: button.addEventListener("click", () => alert("Clicked!"));
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
Answer: It defines a shape that clips (hides) parts of an element. Example: .image { clip-path: circle(50% at 50% 50%); } Key Takeaway: clip-path creates creative shapes like circles, polygons, or custom SVG paths.
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
Answer: Controls what happens when content exceeds the container’s size. Values: visible (default) hidden scroll auto Example: div { overflow: auto; } Key Takeaway: overflow: auto adds scrollbars only when needed.
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
It collects user input and sends it to a server or script for processing.
Example:
<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.JavaScript JavaScript Tutorial · JavaScript
Answer: Variables declared inside a function are accessible only within that function. Example: function demo() { let x = 10; console.log(x); // 10 } console.log(x); // ReferenceError
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
ssigned Follow me on LinkedIn:
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
Answer: Type Meaning null Intentional absence of value undefin Variable declared but not assigned Follow me on LinkedIn:
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
Answer: Property Location Affects Background? Padding Inside border ✅ Yes Margin Outside border ❌ No Example: div { Follow me on LinkedIn: margin: 10px; padding: 20px; } Key Takeaway: Padding = inner spacing, Margin = outer spacing.
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
<picture> allows serving different image versions depending on device, screen size, or
media type.
Example:
<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.
JavaScript JavaScript Tutorial · JavaScript
Example:
<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.JavaScript JavaScript Tutorial · JavaScript
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
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
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
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
Answer: NaN stands for “Not-a-Number”, representing an invalid numeric operation. Example: console.log("hello" / 2); // NaN
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
Answer: Defines how images or videos resize within their container. Follow me on LinkedIn: Example: img { width: 100%; height: 300px; object-fit: cover; } Key Takeaway: cover fills the box; contain fits the whole image inside.
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
Example:
console.log("1");
setTimeout(() => console.log("2"), 0);
console.log("3");
// Output: 1, 3, 2
Follow me on LinkedIn:
JavaScript JavaScript Tutorial · JavaScript
Answer: Used to find the type of a variable. typeof "Hello"; // "string" typeof 10; // "number" typeof null; // "object" (bug)
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
Targets elements with a specific class attribute.
Example:
.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.JavaScript JavaScript Tutorial · JavaScript
Answer: Feature Regular Function Arrow Function this Dynamic Lexical (inherits from parent) Syntax function f(){} (a,b)=>a+b Can be used as constructor ✅ ❌
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
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
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
JavaScript JavaScript Tutorial · JavaScript
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 copyJavaScript JavaScript Tutorial · JavaScript
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:
html { font-size: 16px; }
p { font-size: 2rem; } /* = 32px */
Key Takeaway:
Use rem for consistent sizing across the document.
JavaScript JavaScript Tutorial · JavaScript
The alt attribute provides alternative text when an image fails to load and is read by
screen readers.
Example:
Follow me on LinkedIn:
<img src="team.jpg" alt="Our development team">
Key Takeaway:
lways include meaningful alt text — it’s good for accessibility and SEO.
JavaScript JavaScript Tutorial · JavaScript
Answer: 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
In a production JavaScript application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.