Is it possible to get a class that calls a function in JavaScript?
For instance:
function Foo(){
this.alertCaller = alertCaller;
}
function Bar(){
this.alertCaller = alertCaller;
}
function alertCaller(){
alert(*calling object*);
}
When calling Foo (). alertCaller () I want to output the Foo () class when calling Bar (). alertCaller () I want to disable Bar (). Is there any way to do this?
source
share