O'Reilly logo
  • Karl Giesing thinks this is interesting:

The primary goal of type introspection with class instances is to reason about the structure/capabilities of the object based on how it was created.


Cover of You Don't Know JS: this & Object Prototypes


Not really. Type introspection is usually used to get the latent type rather than the declared type. For example, so that the object can be downcast to a latent subtype, and additional subtype methods can be invoked. How it was created is basically immaterial.