KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Possible Duplicate: javascript - dynamic variables Dynamic Javascript variable names I need to create a number of objects on a page and want to name them sequentially. Is there a way to do this in JavaScript? for (i=0;i<num;i++){ var obj+i = new myObject("param1","param2"); obj+i.someProperty = value; } This way I can dynamically create a varying number of objects (dependent on the value "num") and then set their properties appropriately. I can do this in PHP, is there a way to do it in JavaScript?
Tags (comma-separated)
Save Edits
Cancel