isPrototypeOf Method

Returns a Boolean value indicating whether an object exists in the prototype chain of another object.

function isPrototypeOf(obj : Object) : Boolean


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

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

The following example illustrates the use of the isPrototypeof method.

function test(){
   var re = new RegExp();                        //Initialize variable.
   return (RegExp.prototype.isPrototypeOf(re));  //Return true.

Other Resources

Community Additions