isPrototypeOf Method (Object) (JavaScript)

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

Syntax


prototype.isPrototypeOf(object)  

Parameters

prototype
Required. An object prototype.

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

Remarks

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.

Example

The following example illustrates the use of the isPrototypeOf method.

function Rectangle() {  
}  

var rec = new Rectangle();  

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

// Output: true  

Requirements

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.

See Also

prototype Property (Object)