Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: Arrow functions are shorter, and they don’t have their own this, arguments, or prototype. Follow me on LinkedIn: Example code const obj = { val: 10, normal() { console.log(this.val); }, // Works arrow: () =…
Short answer: Yes. Variables inside the outer function cannot be accessed directly, only via inner functions. Example code See createCounter() above. Real-world example (ShopNest) In ShopNest’s cart UI, a click handler c…
Short answer: Install React-Bootstrap (npm install react-bootstrap bootstrap). Import components: import { Button } from 'react-bootstrap'; <Button variant="primary">Click</Button> Real-world exampl…
Short answer: Use try...catch inside async functions or .catch() for Promises. Example: async function loadData() { try { const res = await fetch('/data'); return await res.json(); } catch (err) { console.error("Err…
Short answer: Using try...catch...finally or Promise .catch(). Example: try { throw new Error("Something went wrong!"); } catch (err) { console.error(err.message); } finally { console.log("Cleanup code&quo…
Short answer: Reusable SCSS functions that generate CSS dynamically. Example: @include border-radius(10px); Example code Reusable SCSS functions that generate CSS dynamically. Example: @include border-radius(10px); Real-…
Short answer: Using object literal: {} Using new Object() constructor Example: let car = { brand: "Tesla", model: "Model 3" }; let car2 = new Object(); car2.brand = "BMW"; Example code Using…
Short answer: Wrap the table in .table-responsive: <div class="table-responsive"> <table class="table">...</table> </div> Real-world example (ShopNest) ShopNest’s browser cart…
Short answer: Functions defined inside objects are called methods. Example code let person = { name: "Sandeep", greet() { console.log(`Hello, ${this.name}`); } }; person.greet(); // Hello, Sandeep Real-world ex…
Short answer: Import only needed components via SCSS. Use tools like PurgeCSS to remove unused classes. Use custom builds from Bootstrap’s build system. Real-world example (ShopNest) ShopNest’s browser cart uses modern J…
Short answer: rrow: () => console.log(this.name), // undefined in global regular() { console.log(this.name); } // Sandeep }; obj.regular(); obj.arrow(); rrow: () => console.log(this.name), // undefined in global re…
Short answer: Load Bootstrap first, then your custom CSS to override styles. Use namespacing or BEM methodology to prevent conflicts. Combine selectively via SCSS imports. Follow me on LinkedIn: Real-world example (ShopN…
Short answer: Global function: this = window (browser) Object method: this = the object Arrow function: this = lexical context (inherits from parent scope) Example code const obj = { name: "Sandeep", arrow: ()…
Short answer: Arrays are ordered collections of values. Example: let numbers = [1, 2, 3, 4]; Example code Arrays are ordered collections of values. Example: let numbers = [1, 2, 3, 4]; Real-world example (ShopNest) ShopN…
Short answer: for loop for...of forEach Example: numbers.forEach(n => console.log(n)); Example code for loop for...of forEach Example: numbers.forEach(n => console.log(n)); Real-world example (ShopNest) ShopNest’s…
Short answer: Objects inherit from other objects via Object.create(), constructor functions, or classes (ES6). Methods can be shared via prototypes. Example using constructor: function Person(name) { this.name = name; }…
Short answer: Classes are blueprints for creating objects. They provide syntactic sugar over the traditional prototype-based inheritance. Example: class Person { constructor(name, age) { this.name = name; Example code th…
Short answer: Classes support extends to create a subclass that inherits properties and methods from a parent class. Example: class Animal { speak() { console.log("Animal speaks"); } } class Dog extends Animal…
Short answer: Static methods are called on the class itself, not on instances. Example code class MathUtils { static square(x) { return x * x; } } console.log(MathUtils.square(5)); // 25 Real-world example (ShopNest) Sho…
Short answer: Yes, getters and setters control access to object properties. Example: class Person { Example code constructor(name) { this._name = name; } get name() { return this._name; } set name(value) { this._name = v…
Short answer: Functions passed as arguments to run after another function completes. Example: setTimeout(() => console.log("Hello after 1s"), 1000); Example code Functions passed as arguments to run after an…
Short answer: pending fulfilled rejected Real-world example (ShopNest) The checkout button uses async/await to call /api/orders , shows a spinner, and catches network errors with a toast. Say this in the interview Define…
Short answer: fetch('/api/data') .then(res => res.json()) .then(data => console.log(data)) .catch(err => console.error(err)); Example code fetch('/api/data') .then(res => res.json()) .then(data => console.…
Short answer: Promise.all – waits for all promises to resolve Promise.race – resolves/rejects as soon as one completes Real-world example (ShopNest) The checkout button uses async/await to call /api/orders , shows a spin…
Short answer: Call stack: executes synchronous code Microtask queue: handles Promises Macrotask queue: handles setTimeout, I/O, etc. Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch API…
JavaScript JavaScript Tutorial · JavaScript
Short answer: Arrow functions are shorter, and they don’t have their own this, arguments, or prototype. Follow me on LinkedIn:
const obj = { val: 10, normal() { console.log(this.val); }, // Works arrow: () => console.log(this.val), // Undefined (no own this) };
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Yes. Variables inside the outer function cannot be accessed directly, only via inner functions.
See createCounter() above.
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: Install React-Bootstrap (npm install react-bootstrap bootstrap). Import components: import { Button } from 'react-bootstrap'; <Button variant="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: Use try...catch inside async functions or .catch() for Promises. Example: async function loadData() { try { const res = await fetch('/data'); return await res.json(); } catch (err) { console.error("Error:", err); } Follow me on LinkedIn: } Advanced
Use try...catch inside async functions or .catch() for Promises. Example: async function loadData() { try { const res = await fetch('/data');
return await res.json(); } catch (err) { console.error("Error:", err); } Follow me on LinkedIn: } Advanced
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: Using try...catch...finally or Promise .catch(). Example: try { throw new Error("Something went wrong!"); } catch (err) { console.error(err.message); } finally { console.log("Cleanup code"); } Intermediate
Using try...catch...finally or Promise .catch(). Example: try { throw new Error("Something went wrong!"); } catch (err) { console.error(err.message); } finally { console.log("Cleanup code"); }
Intermediate
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Reusable SCSS functions that generate CSS dynamically. Example: @include border-radius(10px);
Reusable SCSS functions that generate CSS dynamically. Example: @include border-radius(10px);
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Using object literal: {} Using new Object() constructor Example: let car = { brand: "Tesla", model: "Model 3" }; let car2 = new Object(); car2.brand = "BMW";
Using object literal: {} Using new Object() constructor Example: let car = { brand: "Tesla", model: "Model 3" };
let car2 = new Object();
car2.brand = "BMW";
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Wrap the table in .table-responsive: <div class="table-responsive"> <table class="table">...</table> </div>
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Functions defined inside objects are called methods.
let person = { name: "Sandeep", greet() { console.log(`Hello, ${this.name}`); } }; person.greet(); // Hello, Sandeep
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Import only needed components via SCSS. Use tools like PurgeCSS to remove unused classes. Use custom builds from Bootstrap’s build system.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: rrow: () => console.log(this.name), // undefined in global regular() { console.log(this.name); } // Sandeep }; obj.regular(); obj.arrow(); rrow: () => console.log(this.name), // undefined in global regular() { console.log(this.name); } // Sandeep }; obj.regular(); obj.arrow(); rrow: () => console.log(this.name), // undefined in global regular() {… console.log(this.name); } // Sandeep }; obj.regular(); obj.arrow();…
rrow: () => console.log(this.name), // undefined in global regular() { console.log(this.name); } // Sandeep }; obj.regular(); obj.arrow();
Prefer arrow functions for React/event callbacks in ShopNest so this is not accidentally rebound.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Load Bootstrap first, then your custom CSS to override styles. Use namespacing or BEM methodology to prevent conflicts. Combine selectively via SCSS imports. 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: Global function: this = window (browser) Object method: this = the object Arrow function: this = lexical context (inherits from parent scope)
const obj = { name: "Sandeep", arrow: () => console.log(this.name), // undefined in global regular() { console.log(this.name); } // Sandeep }; obj.regular(); obj.arrow();
Prefer arrow functions for React/event callbacks in ShopNest so this is not accidentally rebound.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Arrays are ordered collections of values. Example: let numbers = [1, 2, 3, 4];
Arrays are ordered collections of values. Example: let numbers = [1, 2, 3, 4];
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: for loop for...of forEach Example: numbers.forEach(n => console.log(n));
for loop for...of forEach Example: numbers.forEach(n => console.log(n));
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Objects inherit from other objects via Object.create(), constructor functions, or classes (ES6). Methods can be shared via prototypes. Example using constructor: function Person(name) { this.name = name; } Person.prototype.greet = function() { console.log(`Hello ${this.name}`); }; const p = new Person("Sandeep"); p.greet(); // Hello Sandeep
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Classes are blueprints for creating objects. They provide syntactic sugar over the traditional prototype-based inheritance. Example: class Person { constructor(name, age) { this.name = name;
this.age = age;
}
}
const sandeep = new Person("Sandeep", 30); console.log(sandeep.name); // Sandeep
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Classes support extends to create a subclass that inherits properties and methods from a parent class. Example: class Animal { speak() { console.log("Animal speaks"); } } class Dog extends Animal { speak() { console.log("Dog barks"); } } const dog = new Dog(); dog.speak(); // Dog barks
Classes support extends to create a subclass that inherits properties and methods from a parent class. Example: class Animal { speak() { console.log("Animal speaks"); } }
class Dog extends Animal { speak() { console.log("Dog barks"); } }
const dog = new Dog(); dog.speak(); // Dog barks
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Static methods are called on the class itself, not on instances.
class MathUtils { static square(x) { return x * x; } } console.log(MathUtils.square(5)); // 25
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Yes, getters and setters control access to object properties. Example: class Person {
constructor(name) { this._name = name; } get name() { return this._name; } set name(value) { this._name = value; }
}
const p = new Person("Sandeep"); console.log(p.name); // Sandeep p.name = "Ravi"; console.log(p.name); // Ravi
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Functions passed as arguments to run after another function completes. Example: setTimeout(() => console.log("Hello after 1s"), 1000);
Functions passed as arguments to run after another function completes. Example: setTimeout(() => console.log("Hello after 1s"), 1000);
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: pending fulfilled rejected
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: fetch('/api/data') .then(res => res.json()) .then(data => console.log(data)) .catch(err => console.error(err));
fetch('/api/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.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Promise.all – waits for all promises to resolve Promise.race – resolves/rejects as soon as one completes
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: Call stack: executes synchronous code Microtask queue: handles Promises Macrotask queue: handles setTimeout, I/O, etc.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
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.