isPrototypeOf Method

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

function isPrototypeOf(obj : Object) : Boolean

Arguments

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

Remarks

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.

Example

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.
}

Requirements

Version 5.5

Applies To:

Object Object

See Also

Other Resources

Methods