1

Lets assume I have a class named Foo in JS:

Foo = function(){
    //properties
};

Now I'd like to know what class some object belongs to:

var fooObj = new Foo();

Is there a way to get the name of the class for my object fooObj, or even better using anonymous object of the class this?

The reason I want this is that using the name for a dynamically generated object's class, I would know what category it belongs to so that I can later modify properties of the object.

Ahmad Baktash Hayeri
  • 5,802
  • 4
  • 30
  • 43

0 Answers0