Search code examples
javascriptoopprototypeprototype-programming

The prototype (parent class) of a prototype object in Javascript?


In Javascript, I can obtain the prototype of Array object by

var arr_prototype = Array.prototype

As I understand, this Array.prototype is similar to a Class in OOP.

In a pure OOP language, the Array class may inherit from Iterable class, and Iterable class may inherit from Object class.

So I wish to see the parent class of arr_prototype by eval the expression arr_prototype.prototype.

However, it returns undefined. Does anyone have ideas about this?


Solution

  • Object.getPrototypeOf(arr_prototype );
    

    prototype property doesn't belong on the instance it belongs on the constructor