valtido Posted March 3, 2009 Share Posted March 3, 2009 is there anyway to do this on javascript ? function foo(id){ this.id = id; } var nVar = new foo('hello'); instead of alert(foo.id) i need to do this var world ='id'; alert(foo.{world}) Quote Link to comment Share on other sites More sharing options...
valtido Posted March 3, 2009 Author Share Posted March 3, 2009 never mind found it for anyone who needs it its alert(foo[world]) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.