Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: DOM (Document Object Model) represents the structure of an HTML document as a tree of objects, allowing JavaScript to access and manipulate elements dynamically. Follow me on LinkedIn: Real-world example (S…
Short answer: <b> only makes text bold visually. <strong> adds semantic meaning (important text). Example: <b>Warning:</b> Incorrect password.<br> <strong>Warning:</strong> Incor…
Short answer: A function passed as an argument to another function to be executed later. Example: function greet(name, callback) { console.log(`Hello, ${name}`); callback(); } Example code greet("Sandeep", () =…
Short answer: Provides consistent button styling: <button class="btn btn-primary">Click</button> Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/a…
Short answer: JSON (JavaScript Object Notation) is a lightweight format for storing and transferring data. Example: let obj = { name: "Bob" }; let json = JSON.stringify(obj); // Convert to JSON string Example c…
Short answer: <i> makes text italic for style only. <em> gives emphasis that can change meaning. Example: <i>Book titles</i> are italicized. Please <em>do not</em> touch that. Follow m…
Short answer: A function that: Always returns the same output for the same input Has no side effects (doesn’t modify external variables) Example: function sum(a, b) { return a + b; Real-world example (ShopNest) ShopNest’…
Short answer: Method Mutates Original? Purpose slice(start, end) ❌ No Extracts portion Follow me on LinkedIn: splice(start, count, ...items) ✅ Yes Adds/removes items Real-world example (ShopNest) ShopNest’s browser cart…
Short answer: localStorage stores key-value pairs in the browser permanently (until cleared). Example code localStorage.setItem("user", "Alice"); console.log(localStorage.getItem("user")); /…
Short answer: float moves elements to the left or right — allowing text and inline elements to wrap around. Example code img { float: right; margin: 10px; } Key Takeaway: Used for text wrapping, but Flexbox/Grid is bette…
Short answer: A favicon is the small icon shown in the browser tab. Example code <link rel="icon" type="image/png" href="favicon.png"> Key Takeaway: Favicons help brand your site in th…
Short answer: A function that calls itself until a base condition is met. Example: function factorial(n) { if (n === 0) return 1; return n * factorial(n - 1); } console.log(factorial(5)); // 120 Example code A function t…
Short answer: Type Example Priority Microtask Promise.then, MutationObserver Higher Macrotask setTimeout, setInterval Lower Example: setTimeout(() => console.log("Macro"), 0); Example code Promise.resolve().…
Short answer: Mutable: Can be changed after creation (e.g., arrays, objects). Immutable: Cannot be changed once created (e.g., strings, numbers). Say this in the interview Define — one clear sentence (the short answer ab…
Short answer: It allows unpacking values from arrays or objects. Example: const [a, b] = [1, 2]; const { name, age } = { name: "John", age: 30 }; Example code It allows unpacking values from arrays or objects.…
Short answer: It defines the page title shown in the browser tab and search results. Example: <title>My Portfolio | </title> Key Takeaway: Make your titles descriptive for better SEO and UX. Intermediate Real…
Short answer: Parameters: variables listed in the function definition Arguments: actual values passed to the function when calling it Example: function greet(name) { // name = parameter console.log(`Hello ${name}`); } Ex…
Short answer: Follow me on LinkedIn: When a function’s final action is calling another function, JS can reuse the stack frame to avoid overflow. Example: function factorial(n, acc = 1) { if (n === 0) return acc; Example…
Short answer: An optimization technique to cache function results for repeated inputs. Example: function memoize(fn) { const cache = {}; return x => cache[x] || (cache[x] = fn(x)); } Example code An optimization techn…
Short answer: Type Description Example Synchronous Executes line by line for loop Follow me on LinkedIn: Asynchronou Doesn’t block — runs later via callbacks, promises setTimeout, fetch() Real-world example (ShopNest) Th…
Short answer: A closure is a function that retains access to variables from its outer scope even after the outer function has executed. Example: function outer() { let count = 0; Example code return function inner() { co…
Short answer: The period between variable declaration and initialization where it cannot be accessed. Example: console.log(x); // ReferenceError let x = 10; Example code The period between variable declaration and initia…
Short answer: Method Add Props Modify Delete preventExtensio ns() ❌ No ✅ Yes ✅ Yes seal() ❌ No ✅ Yes ❌ No freeze() ❌ No ❌ No ❌ No Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs w…
Short answer: A safe way to access nested properties without throwing an error if something is undefined or null. Example: console.log(user?.address?.city); Example code A safe way to access nested properties without thr…
Short answer: Both execute dynamic code, but: eval() executes in the current scope (less safe). Function() executes in a new scope (safer). Example: eval("var a = 5"); const b = new Function("return 5;&quo…
JavaScript JavaScript Tutorial · JavaScript
Short answer: DOM (Document Object Model) represents the structure of an HTML document as a tree of objects, allowing JavaScript to access and manipulate elements dynamically. 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: <b> only makes text bold visually. <strong> adds semantic meaning (important text). Example: <b>Warning:</b> Incorrect password.<br> <strong>Warning:</strong> Incorrect password. Key Takeaway: Use <strong> for emphasis that affects meaning.
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 passed as an argument to another function to be executed later. Example: function greet(name, callback) { console.log(`Hello, ${name}`); callback(); }
greet("Sandeep", () => console.log("Callback executed"));
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Provides consistent button styling: <button class="btn btn-primary">Click</button>
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: JSON (JavaScript Object Notation) is a lightweight format for storing and transferring data. Example: let obj = { name: "Bob" }; let json = JSON.stringify(obj); // Convert to JSON string
JSON (JavaScript Object Notation) is a lightweight format for storing and transferring data. Example: let obj = { name: "Bob" };
let json = JSON.stringify(obj); // Convert to JSON string
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: <i> makes text italic for style only. <em> gives emphasis that can change meaning. Example: <i>Book titles</i> are italicized. Please <em>do not</em> touch that. Follow me on LinkedIn: Key Takeaway: <em> adds importance — <i> adds style.
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: Always returns the same output for the same input Has no side effects (doesn’t modify external variables) Example: function sum(a, b) { return a + b;
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Method Mutates Original? Purpose slice(start, end) ❌ No Extracts portion Follow me on LinkedIn: splice(start, count, ...items) ✅ Yes Adds/removes items
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: localStorage stores key-value pairs in the browser permanently (until cleared).
localStorage.setItem("user", "Alice"); console.log(localStorage.getItem("user")); // Alice
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: float moves elements to the left or right — allowing text and inline elements to wrap around.
img { float: right; margin: 10px; } Key Takeaway: Used for text wrapping, but Flexbox/Grid is better for layout today.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: A favicon is the small icon shown in the browser tab.
<link rel="icon" type="image/png" href="favicon.png"> Key Takeaway: Favicons help brand your site in the browser.
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 calls itself until a base condition is met. Example: function factorial(n) { if (n === 0) return 1; return n * factorial(n - 1); } console.log(factorial(5)); // 120
A function that calls itself until a base condition is met. Example: function factorial(n) { if (n === 0) return 1;
return n * factorial(n - 1);
} console.log(factorial(5)); // 120
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Type Example Priority Microtask Promise.then, MutationObserver Higher Macrotask setTimeout, setInterval Lower Example: setTimeout(() => console.log("Macro"), 0);
Promise.resolve().then(() => console.log("Micro")); // Output: Micro → Macro
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Mutable: Can be changed after creation (e.g., arrays, objects). Immutable: Cannot be changed once created (e.g., strings, numbers).
JavaScript JavaScript Tutorial · JavaScript
Short answer: It allows unpacking values from arrays or objects. Example: const [a, b] = [1, 2]; const { name, age } = { name: "John", age: 30 };
It allows unpacking values from arrays or objects. Example: const [a, b] = [1, 2];
const { name, age } = { name: "John", age: 30 };
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: It defines the page title shown in the browser tab and search results. Example: <title>My Portfolio | </title> Key Takeaway: Make your titles descriptive for better SEO and UX. Intermediate
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Parameters: variables listed in the function definition Arguments: actual values passed to the function when calling it Example: function greet(name) { // name = parameter console.log(`Hello ${name}`); }
greet("Sandeep"); // "Sandeep" = argument
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: When a function’s final action is calling another function, JS can reuse the stack frame to avoid overflow. Example: function factorial(n, acc = 1) { if (n === 0) return acc;
return factorial(n - 1, n * acc); // Tail call
}
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: An optimization technique to cache function results for repeated inputs. Example: function memoize(fn) { const cache = {}; return x => cache[x] || (cache[x] = fn(x)); }
An optimization technique to cache function results for repeated inputs. Example: function memoize(fn) { const cache = {};
return x => cache[x] || (cache[x] = fn(x));
}
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 Example Synchronous Executes line by line for loop Follow me on LinkedIn: Asynchronou Doesn’t block — runs later via callbacks, promises setTimeout, fetch()
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: A closure is a function that retains access to variables from its outer scope even after the outer function has executed. Example: function outer() { let count = 0;
return function inner() { count++; return count; }; }
const counter = outer(); console.log(counter()); // 1 console.log(counter()); // 2
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: The period between variable declaration and initialization where it cannot be accessed. Example: console.log(x); // ReferenceError let x = 10;
The period between variable declaration and initialization where it cannot be accessed. Example: console.log(x); // ReferenceError let x = 10;
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Method Add Props Modify Delete preventExtensio ns() ❌ No ✅ Yes ✅ Yes seal() ❌ No ✅ Yes ❌ No freeze() ❌ No ❌ No ❌ No
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: A safe way to access nested properties without throwing an error if something is undefined or null. Example: console.log(user?.address?.city);
A safe way to access nested properties without throwing an error if something is undefined or null. Example: console.log(user?.address?.city);
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Both execute dynamic code, but: eval() executes in the current scope (less safe). Function() executes in a new scope (safer). Example: eval("var a = 5"); const b = new Function("return 5;"); ⚠ Both are discouraged due to security and performance issues. Bootstrap Interview Questions
Both execute dynamic code, but: eval() executes in the current scope (less safe). Function() executes in a new scope (safer). Example: eval("var a = 5");
const b = new Function("return 5;"); ⚠ Both are discouraged due to security and performance issues. Bootstrap Interview Questions
In ShopNest’s cart UI, a click handler closes over productId. Use let in loops so each button keeps the correct id.
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.