The Array data type
An array is an ordered and inteher-indexed generic collection of elements of any type (including custom classes).
Arrays are typically created with an array literal denoted by square brackets (
) and individual elements are separated by commas:
[1, 2, "skip a few", 99, 100]
Arrays are mutable. Only single dimensional arrays are supported but arrays can be nested. They have a zero-based index (i.e: the first element’s index is 0):
var a =  # Empty array. var b = [1, 2, 3] # Creation of an array and assignment on same line. b = "Hello!" # => [1, "Hello!", 3] b # => 1 # Arrays of mixed types are supported. var c = ["Female", 36, True] # Arrays can contain other arrays. var arr2 = [1, 2, ["a", "b"]]
Comprehensive documentation of the Array object’s methods and getters can be found in the Array section.