This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

isPrototypeOf

Summary

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

Syntax

isPrototypeOf( object2 )
object2
Required. Another object whose prototype chain is to be checked.

Examples

The following example illustrates the use of the isPrototypeOf method.

var re = new RegExp();
 document.write(RegExp.prototype.isPrototypeOf(re));

 // Output: true

Remarks

The isPrototypeOf method returns true if object2 has object1 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 object2 is not an object or when object1 does not appear in the prototype chain of the object2.

See also

Specification

15.2.4.6 Object.prototype.isPrototypeOf (V) ECMAScript® Language Specification Standard ECMA-262 5.1 Edition / June 2011

Attributions

  • Microsoft Developer Network: Article