Variable name as a string in Javascript

Posted by fish potato on Stack Overflow See other posts from Stack Overflow or by fish potato
Published on 2011-01-05T08:40:03Z Indexed on 2011/01/05 8:54 UTC
Read the original article Hit count: 197

Filed under:

Is there a way to get a variable name as a string in Javascript? (like NSStringFromSelector in Cocoa)

I would like to do like this:

var myFirstName = 'John';
alert(variablesName(myFirstName) + ":" + myFirstName);

--> myFirstName:John

-- added

I'm trying to connect a browser and another program using JavaScript. I would like to send instance names from a browser to another program for callback method.

© Stack Overflow or respective owner

Related posts about JavaScript