To check if the constructor is a constructor of an object1 , do :
object1=new MyConstructor();
object1 instanceof MyConstructor === true
if MyConstructor inherits from MyParentConstructor :
object1 instanceof MyParentConstructor === true
Also, if MyParentConstructor inherits from MyGrandParentConstructor :
object1 instanceof MyGrandParentConstructor === true
It is evident that all classes inherits from Object
, thus :
object1 instanceof Object === true
Now , What is the code of parents method which give us :
MyConstructor.parents() ===[MyParentConstructor,MyGrandParentConstructor,Object]
HTMLDivElement.parents() === [HTMLElement,Element,Object]
Note that you can create a class inherited from another class