Array


Syntax
  • [elem1, elem2, ..., elemN]
Usage
  • Array elements are zero-based.
  • Arrays are objects whose properties are accessed by a number representing their position in the array.
Properties
  • length : The number of elements in the array.
Methods
  • reverse() : Reverses the order of the array elements.
  • sort() : Sorts the array elements.
  • pop() : Removes and returns the last element from an array.
  • push(value, [value]*) : Adds one or more elements to the end of an array and returns the new length of the array.
  • shift() : Removes and returns the first element from an array.
  • unshift(value, [value]*) : Adds one or more elements to the front of an array and returns the new length of the array.
  • concat(anArray) : Joins two arrays and returns a new array.
  • join([separatorStr]) : Joins all elements of an array into a string.
  • slice([startIndex, [endIndex]]) : Returns a portion of an array and as a new array, from startIndex up to, but not including, endIndex.
  • splice(startIndex, deleteCount [, value]*) : Adds and/or removes elements to/from an array, at the specified index.
Examples
var myArray1:Array = [];
var myArray2:Array = ["orange", "blue", "green"];

var myArray3:Array = new Array();
var myArray4:Array = new Array(numElements);

var myArray5:Array = [["one", "two"], ["un", "deux"]];
myArray5[1][0] = "une";