Thursday, October 16, 2025
HomeLanguagesJavascriptJavaScript Object isPrototypeOf() Method

JavaScript Object isPrototypeOf() Method

The Object.isPrototypeOf() method in Javascript checks if an object exists in another object’s prototype chain.

Syntax:

prototypeObj.isPrototypeOf(object)

Parameters: This object accepts a single parameter.

  • object: This is an object, whose prototype chain will be searched.

Return value: This method returns a boolean value.

Errors thrown: A Type Error is thrown if prototypeObj is undefined or null.

Example: This example shows the basic use of the JavaScript Object.prototype.isPrototypeOf() method.

javascript




function obj1() { }
function obj2() { }
  
obj1.prototype = Object.create(obj2.prototype);
const obj3 = new obj1();
console.log(obj1.prototype.isPrototypeOf(obj3));
console.log(obj2.prototype.isPrototypeOf(obj3));


Output:

true
true

Example 2: This example illustrates that C.prototype, B.prototype, A.prototype, and Object.prototype exist in the prototype chain for object c:

javascript




function A() { }
function B() { }
function C() { }
  
B.prototype = Object.create(A.prototype);
C.prototype = Object.create(B.prototype);
  
let c = new C();
  
console.log(C.prototype.isPrototypeOf(c));
console.log(B.prototype.isPrototypeOf(c));
console.log(A.prototype.isPrototypeOf(c));
console.log(Object.prototype.isPrototypeOf(c));


Output:

true
true
true
true

We have a complete list of Javascript Object Methods, to check those please go through the Javascript Object Complete Reference article.

Supported Browser:

  • Chrome 1 and above
  • Edge 12 and above
  • Firefox 1 and above
  • Internet Explorer-9 and above
  • Opera 4 and above
  • Safari 3 and above
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11953 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS