javascriptclass-hierarchy

What does the built in object hierarchy look like in javascript?


I was looking for a diagram which shows the built in types of javascript like Function and String but on google I keep finding diagrams with the browser-related stuff like Window.

I'm just looking for the pure js object diagram. I know about the ECMA specification but I'm looking for a diagram because I'm a visual type.


Solution

  • There's not much depth to the JavaScript types to speak of, the diagram would be fairly flat. It's basically like this (UML at the end), though this will get outdated over time as JavaScript is an evolving language:

    I think that's up-to-date through ES2022. To get the latest info, check the latest editor's draft of the specification.

    In UML, it looks something like this:

    Flat class hierarchy in JavaScript

    (click the image to open it so you can zoom)

    Note that this is just JavaScript's type tree. It doesn't include lots of other things that are often used with JavaScript on browsers (such as the DOM, the workers API, web storage, the File API, etc., etc.).