Questions
3 of 32
1What is the constructor function?
2What are Objects?
3What are the properties of an object?
4How does javascript implements object oriented programming?
5What are the key differences between javascript’s Object-based Inheritance and Conventional Class-based Inheritance?
6What is a prototype in JavaScript?
7How we can implement prototype-based inheritance?
8Explain the prototype chain and its role in property lookup.
9What is the difference between an object's `__proto__` and a constructor function's `prototype` property and [[Prototype]]?
10What are object wrappers for primitive type?
11Can you explain the use of object wrappers with examples?
12Explain how the `instanceof` operator works.
13What are different methods to create an object?
14What is an object initializer?
15What does the `Object.create()` method do?
16How are constructor functions used to create objects with shared properties and methods?
17Show an example of ES6 classes to create objects and inherit properties?
18What are factory functions in JavaScript ?
19What are Object constructors in JavaScript ?
20How can you add new properties and methods to the prototype of an existing constructor function?
21What is prototype pollution, and how can it be a security risk in JavaScript?
22Is modifying or extending built-in object prototypes recommended (e.g., adding a method to `Array.prototype`)? Why or why not?
23What happens when you try to access a property that doesn't exist on an object?
24How can you prevent or mitigate prototype pollution vulnerabilities in your code?
25How does the `Object.prototype.hasOwnProperty()` method work?
26How can you optimize prototype chain lookup for better performance?
27Can you explain how `Object.prototype.constructor` property works?
28What is the difference between modifying the prototype of an object and adding a property directly to the object?
29How does JavaScript handle circular references in object prototypes?
30What is static dispatching in object-oriented programming?
31What is the purpose of the `Object.keys()` method?
32Write a function flattenObject(obj) that flattens a deeply nested object into a single-level object, using dot notation for nested keys.
03 / 32

What are the properties of an object?

Difficulty: 3/10
enumerability, prototype chain, property descriptors
Objects can be seen as a collection of properties. There are two main types of object properties:
  1. 1

    The data property: Data properties associate a key with a value.

  2. 2

    Methods: When a property holds a function, it is called a Method. Methods represent the 'actions' an object can perform.

Scenario Questions

0-2 years experience

  1. 1If you have const user = {name: 'Alice', age: 30}, how would you add a new property 'email' to this object without using the dot notation?
  2. 2What will console.log(Object.keys(user)) output after you delete the 'age' property? Explain why.
  3. 3How does JavaScript treat a property that you set to undefined versus a property that doesn't exist on the object?

2-5 years experience

  1. 1We have a function that copies properties from one object to another using a for...in loop, but it's unexpectedly also copying prototype properties. How would you fix it?
  2. 2During a bug hunt, a property you assumed was a number is actually a string, breaking a calculation. How would you verify and enforce the correct type when the object comes from an API response?
  3. 3Explain why Object.defineProperty can be used to make a property read‑only, and show how you'd apply it to protect a configuration object from accidental mutation.

5-8 years experience

  1. 1Our caching layer stores objects with many nested properties. We need to serialize them for Redis but also preserve non‑enumerable properties. How would you design a serialization strategy that handles enumerable vs non‑enumerable properties?
  2. 2A performance hotspot was traced to repeatedly checking if a property exists on a large object. What are the trade‑offs between using 'in', 'hasOwnProperty', and 'Object.hasOwn' in this scenario, and which would you choose?
  3. 3We are refactoring a legacy codebase that relies on mutating object properties directly. How would you introduce immutable patterns while still allowing selective property updates, considering prototype inheritance?

8+ years experience

  1. 1Our organization is moving from a monolithic JavaScript service to a micro‑frontend architecture. How would you standardize object property definitions (enumerable, configurable, writable) across teams to avoid subtle bugs when sharing data between services?
  2. 2We need to design a library that exposes configuration objects to third‑party developers. What guidelines would you set for property naming, descriptor defaults, and deprecation handling to ensure long‑term maintainability?
  3. 3When migrating a large codebase from ES5 to ES6+ modules, how would you audit and refactor usage of dynamic property addition (e.g., obj[prop] = value) to improve tree‑shaking and bundle size?

Follow-up Questions

  • Can you walk me through how you would test that your solution works?
  • What edge cases might still cause issues with your approach?
  • How would you communicate these changes to the rest of the team?
Share

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.