Is it possible to get the class calling a function in JavaScript?
For example:
function Foo(){
this.alertCaller = alertCaller;
}
function Bar(){
this.alertCaller = alertCaller;
}
function alertCaller(){
alert(*calling object*);
}
When calling the Foo().alertCaller() i want to output the class Foo() and when calling Bar().alertCaller() I want to outbut Bar(). Is there any way I can do this?