How to retrieve the constructor's name in JavaScript?

Viewed 40685

Assume the following program:

var SomeConstructor = function() { };
var instance = = new SomeConstructor ();

The expression instance instanceof SomeConstructor yields True, so instance has to know somehow that it was constructed by the function SomeConstructor. Is there way to retrieve the name SomeConstructor directly from instance?

(In my problem at hand, I have a hierarchy of prototypes implementing possible signals in my application. I have to access the type of a signal which shall be equivalent to the constructor used to create that signal.)

6 Answers
Related