Inspired from Inheritance and the prototype chain on
First we defined a function to print the chain.
Now, we test it out for all the standard built-in objects collected from here.
As you can see, most of them are specialized functions that inherit from the
function function, which inherits from the
object Object, which inherits
Math are the exceptions as they inherit from the
Also, it shows that
typeof nullis an object.
Let’s try it with some real values
Look more carefully, and see what they are. You could also inspect each node in
the browser dev tools, which will provide more insight as they won’t be have to
be printed in just plain string.