A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript-object-isprototypeof-method/ below:

JavaScript Object isPrototypeOf() Method - GeeksforGeeks

JavaScript Object isPrototypeOf() Method

Last Updated : 15 Jul, 2025

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.

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:



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4