Possible Duplicate:
Determine original name of variable after its passed to a function
Get the reference name of an object?
Not exactly sure how to explain this. I'm looking to get a string value of the variable name, in an object itself.
For instance:
var MyObject = function(){
var that = this;
that.alertMyName = function(){
var name_of_instance = that.__name__;
alert(name_of_instance); //hoping to retreive a string containing 'var1'?
}
};
var var1 = new MyObject();
var1.alertMyName();