Every object gets the isPrototypeOf() method. Using this method we can find if the specific object is used as a prototype of another object.

Create a simple object monkey.

var monkey = {
    hair: true,
    feeds: 'bananas',
    breathes: 'air'

Create a Human() constructor function and set its prototype property to point to monkey.

function Human(name) { = name;
Human.prototype = monkey;

Now create a new Human object called george and check if monkey is prototype of george. It will return true.

var george = new Human('George');

Related Tutorial
Follow Us #
Contents +