function ArrayList()
{
this.array = new Array();
this.add = function(obj){
this.array[this.array.length] = obj;
}
this.iterator = function (){
return new Iterator(this)
}
this.length = function (){
return this.array.length;
}
this.get = function (index){
return this.array[index];
}
this.addAll = function (obj)
{
if (obj instanceof Array){
for (var i=0;i<obj.length;i++)>
{
this.add(obj[i]);
}
} else if (obj instanceof ArrayList){
for (var i=0;i<obj.length();i++)>
{
this.add(obj.get(i));
}
}
}
}
function Iterator (arrayList){
this.arrayList;
this.index = 0;
this.hasNext = function (){
return this.index < this.arrayList.length();
}
this.next = function() {
return this.arrayList.get(index++);
}
}
Or See this link
http://www.koders.com/javascript/fid32ECAD6CCE114257D4044549E14ABCEC1332DF7E.aspx[
^]
another way,-
var myArray = new Array();
myArray.push("string 1");
myArray.push("string 2");