Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Answer: Used to expand arrays or objects into individual elements. Example: const arr = [1, 2, 3]; const newArr = [...arr, 4, 5]; // [1, 2, 3, 4, 5] What interviewers expect A clear definition tied to JavaScript in JavaS…
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 = Obje…
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. Example:…
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.prototy…
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 What interviewers expect A cle…
property of functions, used when creating objects with new. __proto __ property of objects, points to the object’s prototype (used in the prototype chain). Example: function Person() {} console.log(Person.prototype); //…
Property Description prototy 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: function Person() {} cons…
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 san…
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; } } What interviewers expect A clear…
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 What interviewers expect…
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(…
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…
Answer: Static methods are called on the class itself, not on instances. Example: class MathUtils { static square(x) { return x * x; } } console.log(MathUtils.square(5)); // 25 What interviewers expect A clear definition…
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 Per…
Answer: llows non-blocking execution, letting other code run while waiting for tasks (e.g., network requests). What interviewers expect A clear definition tied to JavaScript in JavaScript projects Trade-offs (performance…
A callback is a function passed as an argument to another function to be executed after some operation completes. Example: function fetchData(callback) { setTimeout(() => { callback("Data received!"); }, 1000); Follow…
Answer: Nested callbacks causing hard-to-read code. Solution: Use Promises or async/await. What interviewers expect A clear definition tied to JavaScript in JavaScript projects Trade-offs (performance, maintainability, s…
n object representing future completion or failure of an async task. What interviewers expect A clear definition tied to JavaScript in JavaScript projects Trade-offs (performance, maintainability, security, cost) When yo…
pending fulfilled rejected 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 production…
Answer: fetch('/api/data') .then(res => res.json()) .then(data => console.log(data)) .catch(err => console.error(err)); What interviewers expect A clear definition tied to JavaScript in JavaScript pr…
Answer: sync function fetchData() { try { const res = await fetch('/api/data'); const data = await res.json(); console.log(data); } catch (err) { console.error(err); } } What interviewers expect A clear definition tied t…
Answer: Promise.all – waits for all promises to resolve Promise.race – resolves/rejects as soon as one completes What interviewers expect A clear definition tied to JavaScript in JavaScript projects Trade-offs (performan…
Answer: Mechanism that manages async callbacks and executes them after the call stack is empty. What interviewers expect A clear definition tied to JavaScript in JavaScript projects Trade-offs (performance, maintainabili…
Answer: Call stack: executes synchronous code Microtask queue: handles Promises Macrotask queue: handles setTimeout, I/O, etc. What interviewers expect A clear definition tied to JavaScript in JavaScript projects Trade-o…
n action like click, load, input, keypress. 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…
JavaScript JavaScript Tutorial · JavaScript
Answer: Used to expand arrays or objects into individual elements. Example: const arr = [1, 2, 3]; const newArr = [...arr, 4, 5]; // [1, 2, 3, 4, 5]
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
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
JavaScript JavaScript Tutorial · JavaScript
The prototype chain is the chain of objects that JavaScript follows to look up properties
or methods.
continues up the chain.
Example:
console.log(child.toString()); // from Object.prototype
JavaScript JavaScript Tutorial · JavaScript
or classes (ES6).
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
JavaScript JavaScript Tutorial · JavaScript
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
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
property of functions, used when creating objects with new.
__proto
__
property of objects, points to the object’s prototype (used in the prototype
chain).
Example:
function Person() {}
console.log(Person.prototype); // prototype object
const p = new Person();
console.log(p.__proto__); // same as Person.prototype
JavaScript JavaScript Tutorial · JavaScript
Property Description
prototy
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:
function Person() {}
console.log(Person.prototype); // prototype object
const p = new Person();
console.log(p.__proto__); // same as Person.prototype
🔹 6. Classes (ES6+) – Q&A
JavaScript JavaScript Tutorial · JavaScript
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
JavaScript JavaScript Tutorial · JavaScript
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; } }
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: 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 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
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
JavaScript JavaScript Tutorial · JavaScript
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;
}
}JavaScript JavaScript Tutorial · JavaScript
Answer: Static methods are called on the class itself, not on instances. Example: class MathUtils { static square(x) { return x * x; } } console.log(MathUtils.square(5)); // 25
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
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
JavaScript JavaScript Tutorial · JavaScript
Answer: llows non-blocking execution, letting other code run while waiting for tasks (e.g., network requests).
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
A callback is a function passed as an argument to another function to be executed after
some operation completes.
Example:
function fetchData(callback) {
setTimeout(() => {
callback("Data received!");
}, 1000);
Follow me on LinkedIn:
}
fetchData(console.log);
JavaScript JavaScript Tutorial · JavaScript
Answer: Nested callbacks causing hard-to-read code. Solution: Use Promises or async/await.
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
n object representing future completion or failure of an async task.
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
pending fulfilled rejected
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: fetch('/api/data') .then(res => res.json()) .then(data => console.log(data)) .catch(err => console.error(err));
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: sync function fetchData() { try { const res = await fetch('/api/data'); const data = await res.json(); console.log(data); } catch (err) { console.error(err); } }
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: Promise.all – waits for all promises to resolve Promise.race – resolves/rejects as soon as one completes
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: Mechanism that manages async callbacks and executes them after the call stack is empty.
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: Call stack: executes synchronous code Microtask queue: handles Promises Macrotask queue: handles setTimeout, I/O, etc.
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
n action like click, load, input, keypress.
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.