Is there a more elegant way to retrieve the class name of a class in JavaScript?
I have implemented a method and would like to log any errors with a message indicating the class in which the error occurred.
My current solution feels a bit "dirty": I am storing the class name in the constructor like this:
constructor{
this.className = 'MyClass';}
However, I believe there must be a better solution, perhaps using Object.prototype.XXX.
I have searched Google and Stack Overflow, but none of the answers provided the output I am looking for.
Does anyone have any ideas on a better approach?