alexhernandez 0 Newbie Poster

Hi all,

I'm just wondering..... Is there any way to know what variables are associated to a given kind of data type or class (when using prototype for example)?

Let me explain.

if I have:

// Javascript:

var myVar = new Array();
var myObj = new CustomPrototypeClass();

So, in some way I want to do something like:


alert(myVar.variableName())

that shows:

myVar

or

alert(myObj.variableName);

will show

myObj


what I need to do is reference a variable inside another code depending on the type of object I'm manipulating. I'm getting that effect including the name of the variable as a parameter to my custom class, like:

var myObj = new CustomObject(param1, param2, "myObj");

But it looks too freaking weird!!!!!!

Is there any other elegant way to achieve what I want? any Ideas? I think I'm good at JS but I can't figure it out.

thanks in advance.

Alex