Image

Imagebloc07 wrote in Imagewebdev

finding class name of an object in js

Is there a way to find the class name of variable?

typeof(obj); //<-- only says 'object'

obj instanceof MyClass // <- returns boolean

But I want the equivalent of ruby's class() method.

obj.class() # <- outputs 'MyClass'