isPrototypeOf Method (Object) (JavaScript)

Determines whether an object exists in another object's prototype chain.

prototype.isPrototypeOf(object)

prototype

Required. An object prototype.

object

Required. Another object whose prototype chain is to be checked.

The isPrototypeOf method returns true if object has prototype in its prototype chain. The prototype chain is used to share functionality between instances of the same object type. The isPrototypeOf method returns false when object is not an object or when prototype does not appear in the prototype chain of the object.

The following example illustrates the use of the isPrototypeOf method.

function Rectangle() {
}

var rec = new Rectangle();

document.write(Rectangle.prototype.isPrototypeOf(rec));

// Output: true

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

Show:
© 2014 Microsoft