Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
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…
Short answer: The constructor is a special method for initializing new objects created from a class. Example: class Car { constructor(brand, model) { this.brand = brand; this.model = model; } } Example code The construct…
Short answer: Feature Function Constructor Class Syntax function Person(){} class Person{} Hoisting Yes, function declarations are hoisted No, classes are not hoisted new required Recommended Required Real-world example…
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: super() calls the parent class constructor. Must be called before using this in subclass. Example: class Animal { Example code constructor(name) { this.name = name; } } class Dog extends Animal { constructo…
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: Allows non-blocking execution, letting other code run while waiting for tasks (e.g., network requests). Say this in the interview Define — one clear sentence (the short answer above). Example — relate it to…
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: Nested callbacks causing hard-to-read code. Solution: Use Promises or async/await. Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and cle…
Short answer: n object representing future completion or failure of an async task. Real-world example (ShopNest) The checkout button uses async/await to call /api/orders , shows a spinner, and catches network errors with…
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: sync function fetchData() { try { const res = await fetch('/api/data'); const data = await res.json(); console.log(data); } catch (err) { console.error(err); } } sync function fetchData() { try { const res…
Short answer: Syntactic sugar over Promises for cleaner asynchronous code. async function fetchData() { try { const res = await fetch('/api/data'); const data = await res.json(); console.log(data); } catch (err) { consol…
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: Mechanism that manages async callbacks and executes them after the call stack is empty. Real-world example (ShopNest) The checkout button uses async/await to call /api/orders , shows a spinner, and catches…
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…
Short answer: n action like click, load, input, keypress. 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 inte…
Short answer: button.addEventListener('click', () => console.log('Clicked!')); button.addEventListener('click', () => console.log('Clicked!')); button.addEventListener('click', () => console.log('Clicked!')); bu…
Short answer: ttach a listener to a parent to handle events on child elements. Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.…
Short answer: preventDefault() – stops default browser action stopPropagation() – stops event bubbling Real-world example (ShopNest) ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, a…
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.
JavaScript JavaScript Tutorial · JavaScript
Short answer: The constructor is a special method for initializing new objects created from a class. Example: class Car { constructor(brand, model) { this.brand = brand; this.model = model; } }
The constructor is a special method for initializing new objects created from a class. Example: class Car { constructor(brand, model) { this.brand = brand;
this.model = model;
}
}
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: Feature Function Constructor Class Syntax function Person(){} class Person{} Hoisting Yes, function declarations are hoisted No, classes are not hoisted new required Recommended Required
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: 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: super() calls the parent class constructor. Must be called before using this in subclass. Example: class Animal {
constructor(name) { this.name = name; }
}
class Dog extends Animal { constructor(name, breed) { super(name); this.breed = breed;
}
}
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: Allows non-blocking execution, letting other code run while waiting for tasks (e.g., network requests).
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: Nested callbacks causing hard-to-read code. Solution: Use Promises or async/await.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: n object representing future completion or failure of an async task.
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: 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: sync function fetchData() { try { const res = await fetch('/api/data'); const data = await res.json(); console.log(data); } catch (err) { console.error(err); } } sync function fetchData() { try { const res = await fetch('/api/data'); const data = await res.json(); console.log(data); } catch (err) { console.error(err); } }… sync function fetchData() { try {… const res = await fetch('/api/data'); const data = await…
res.json(); console.log(data); } catch (err) { console.error(err); } } sync function fetchData() { try { const res = await fetch('/api/data'); const data = await res.json(); 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: Syntactic sugar over Promises for cleaner asynchronous code. async function fetchData() { try { const res = await fetch('/api/data'); const data = await res.json(); console.log(data); } catch (err) { console.error(err); } }
Syntactic sugar over Promises for cleaner asynchronous code. async function fetchData() { try { const res = await fetch('/api/data');
const data = await res.json(); 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: Mechanism that manages async callbacks and executes them after the call stack is empty.
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.
JavaScript JavaScript Tutorial · JavaScript
Short answer: n action like click, load, input, keypress.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: button.addEventListener('click', () => console.log('Clicked!')); button.addEventListener('click', () => console.log('Clicked!')); button.addEventListener('click', () => console.log('Clicked!')); button.addEventListener('click', () => console.log('Clicked!'));
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: ttach a listener to a parent to handle events on child elements.
ShopNest’s browser cart uses modern JavaScript: fetch APIs with async/await, modules, and clear error handling.
JavaScript JavaScript Tutorial · JavaScript
Short answer: preventDefault() – stops default browser action stopPropagation() – stops event bubbling
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.