User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 391,606 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,612 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 279 | Replies: 0
Reply
Join Date: May 2008
Posts: 2
Reputation: alexhernandez is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
alexhernandez alexhernandez is offline Offline
Newbie Poster

Discovering variables in javascript

  #1  
May 16th, 2008
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
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 12:03 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC