var thearrayname= new Array();
thearrayname = "White"; thearrayname = "Red"; thearrayname = "Green"; thearrayname = "Yellow"; thearrayname = "Purple";
Note: You can add any number of elements as you want. If you missed any index in between length you will get “undefined”. But you can continue the loop till to end.
Note: Since we don’t know the length we can loop through the array by using the array length function (here thearrayname.length). Another important thing is in the above code we did not assign any value to the index 4. See the impact from below.