Declaring array of objects in Javascript

Ju4nCh0

New Member
Well ..!! I have a variable which is an array and i want every element of the should act as a object . To achieve this , i can do something like this in my code ..\[code\]var sample = new Array();sample[0] = new Object();sample[1] = new Object();\[/code\]This works fine but what i need is i don't want to mention any index number .. I mean i want all elements of my array to be an object . How do i declare or initialize it ..??\[code\]var sample = new Array();sample[] = new Object();\[/code\]I tried the above code but it doesn't works.. How to initialize an array of objects without using index number..??
 
Back
Top