Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
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: Lexical scoping means that the scope of a variable is determined by its position in the source code. Inner functions have access to variables declared in their outer scope. Example code function outer() { l…
Short answer: Reboot is a modernized CSS reset that standardizes browser styles for consistent rendering. Follow me on LinkedIn: Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs wi…
Short answer: An object is a collection of key-value pairs used to store related data and functions. Example: let person = { name: "Sandeep", age: 30 }; Example code An object is a collection of key-value pairs…
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: this refers to the context in which a function is called. Real-world example (ShopNest) Prefer arrow functions for React/event callbacks in ShopNest so this is not accidentally rebound. Say this in the inte…
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: Extract values from objects into variables. Example: const person = { name: "Sandeep", age: 30 }; const { name, age } = person; console.log(name, age); // Sandeep 30 Example code Extract values fr…
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: Extract elements from arrays into variables. Example: let [first, second] = [10, 20]; console.log(first, second); // 10 20 Example code Extract elements from arrays into variables. Example: let [first, seco…
Short answer: Allows expanding arrays or objects. Example: let arr1 = [1, 2]; let arr2 = [...arr1, 3, 4]; // [1,2,3,4] let obj1 = { a: 1 }; let obj2 = { ...obj1, b: 2 }; // { a:1, b:2 } Example code Allows expanding arra…
Short answer: JavaScript objects inherit properties and methods from other objects through prototypes. This allows reuse of methods and shared behavior. Example: const parent = { greet() { console.log("Hello");…
Short answer: The prototype chain is the chain of objects that JavaScript follows to look up properties or methods. If a property isn’t found on the object itself, JS checks the object's prototype, and continues up the c…
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: Creates a new object with the specified prototype object. Example: const parent = { greet() { console.log("Hello"); } }; const child = Object.create(parent); child.greet(); // Hello Example code C…
Short answer: property of functions, used when creating objects with new. Explain a bit more __proto __ property of objects, points to the object’s prototype (used in the prototype chain). property of functions, used whe…
Short answer: Property Description prototy pe A property of functions, used when creating objects with new. __proto __ A property of objects, points to the object’s prototype (used in the prototype chain). Example code f…
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…
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: Lexical scoping means that the scope of a variable is determined by its position in the source code. Inner functions have access to variables declared in their outer scope.
function outer() { let name = "Sandeep"; function inner() { console.log(name); // accesses outer variable } inner(); } outer(); // Sandeep
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Reboot is a modernized CSS reset that standardizes browser styles for consistent rendering. 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: An object is a collection of key-value pairs used to store related data and functions. Example: let person = { name: "Sandeep", age: 30 };
An object is a collection of key-value pairs used to store related data and functions. Example: let person = { name: "Sandeep", 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: 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: this refers to the context in which a function is called.
Prefer arrow functions for React/event callbacks in ShopNest so this is not accidentally rebound.
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: Extract values from objects into variables. Example: const person = { name: "Sandeep", age: 30 }; const { name, age } = person; console.log(name, age); // Sandeep 30
Extract values from objects into variables. Example: const person = { name: "Sandeep", age: 30 };
const { name, age } = person; console.log(name, age); // Sandeep 30
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
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: Extract elements from arrays into variables. Example: let [first, second] = [10, 20]; console.log(first, second); // 10 20
Extract elements from arrays into variables. Example: let [first, second] = [10, 20]; console.log(first, second); // 10 20
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Allows expanding arrays or objects. Example: let arr1 = [1, 2]; let arr2 = [...arr1, 3, 4]; // [1,2,3,4] let obj1 = { a: 1 }; let obj2 = { ...obj1, b: 2 }; // { a:1, b:2 }
Allows expanding arrays or objects. Example: let arr1 = [1, 2];
let arr2 = [...arr1, 3, 4]; // [1,2,3,4]
let obj1 = { a: 1 };
let obj2 = { ...obj1, b: 2 }; // { a:1, b:2 }
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: JavaScript objects inherit properties and methods from other objects through prototypes. This allows reuse of methods and shared behavior. Example: const parent = { greet() { console.log("Hello"); } };
const child = Object.create(parent); child.greet(); // Hello
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: The prototype chain is the chain of objects that JavaScript follows to look up properties or methods. If a property isn’t found on the object itself, JS checks the object's prototype, and continues up the chain.
console.log(child.toString()); // from Object.prototype
Prefer arrow functions for React/event callbacks in ShopNest so this is not accidentally rebound.
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: Creates a new object with the specified prototype object. Example: const parent = { greet() { console.log("Hello"); } }; const child = Object.create(parent); child.greet(); // Hello
Creates a new object with the specified prototype object. Example: const parent = { greet() { console.log("Hello"); } };
const child = Object.create(parent); child.greet(); // Hello
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: property of functions, used when creating objects with new.
__proto __ property of objects, points to the object’s prototype (used in the prototype chain). property of functions, used when creating objects with new. __proto __ property of objects, points to the object’s prototype (used in the prototype chain). property of functions, used when creating objects with new. __proto __ property of objects, points to the object’s prototype (used in the prototype chain). function Person() {} console.log(Person.prototype); // prototype object const p = new Person(); console.log(p.__proto__); // same as Person.prototype property of functions, used when creating objects with new. __proto __ property of objects, points to the object’s prototype (used in the prototype chain).
function Person() {} console.log(Person.prototype); // prototype object const p = new Person(); console.log(p.__proto__); // same as Person.prototype
Prefer arrow functions for React/event callbacks in ShopNest so this is not accidentally rebound.
JavaScript JavaScript Tutorial · JavaScript
Short answer: Property Description prototy pe A property of functions, used when creating objects with new. __proto __ A property of objects, points to the object’s prototype (used in the prototype chain).
function Person() {} console.log(Person.prototype); // prototype object const p = new Person(); console.log(p.__proto__); // same as Person.prototype
Prefer arrow functions for React/event callbacks in ShopNest so this is not accidentally rebound.
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.