Array.concat()
The concat() method returns a new array created by appending new elements to the end of an existing array.
var myChest1 = new Array("cup","ball","hat");
myChest1 = myChest1.concat("pen");
var myChest2 = new Array("spoon","apple","gloves");
myChest1 = myChest1.concat(myChest2);
|
Array.join( delimiter)
The join() method returns a string created by combining all the elements of an array. If you don't specify any delimiter it will be a comma by default.
var myChest = new Array("cup","ball","hat");
myChestString = myChest.join("|");
trace(myChestString);
|
This
method can be useful if you need to convert an array into a string of strings separated by a comma (or any other delimiter), for example to create a CSV(comma separated values) file with PHP.
Array.pop()
The pop() method deletes the last element of an array.
reduces the array's length by 1 and returns the value of the deleted element.
var myChest = new Array("cup","ball","hat");
trace("Now deleting '"+myChest.pop()+"' the new array is : "+myChest);
|
Array.push()
The push() method appends a list of values to the end of an array as new elements. Elements are added in the order provided. It differs from concat() in that push() modifies the original array, whereas concat() creates a new array.
var myChest = new Array("cup","ball","hat");
myChest.push("spoon","chair");
trace(myChest);
|
|