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}) Link to comment https://forums.phpfreaks.com/topic/147718-solved-simple-object-question/ 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]) Link to comment https://forums.phpfreaks.com/topic/147718-solved-simple-object-question/#findComment-775388 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.