This is a migrated thread and some comments may be shown as answers.

How to obtain the name of a Javascript variable

0 Answers 50 Views
Miscellaneous
This is a migrated thread and some comments may be shown as answers.
Jochen Neyens
Top achievements
Rank 1
Jochen Neyens asked on 24 Feb 2006, 08:06 AM
Is there a function that can be used to get the name of a Javascript variable? Look at the example below. Is there a function like "GetVarName"? alert(GetVarName(tt)) sould alert the text "myText" ...

var myText = "lorem";

function test(tt) {
    alert(GetVarName(tt));
}

test(tt);

No answers yet. Maybe you can help?

Tags
Miscellaneous
Asked by
Jochen Neyens
Top achievements
Rank 1
Share this question
or