Developer   API   Core & System   Array

Array(native)

Represents indexed vector (array) of values. The Array object is used to store multiple values in a single variable.

Example

// An array can be defined in three ways. // 1. var myCars=new Array(); myCars[0]="Saab"; myCars[1]="Volvo"; myCars[2]="BMW"; // 2. var myCars=new Array("Saab", "Volvo", "BMW"); // condensed array // 3. var myCars=["Saab", "Volvo", "BMW"]; // literal array

Properties

  • [begin..end] : Object
    Returns part of vector and contains elements from beginning index and up to or excluded end index. Begin or/and end are optional. If begin is ommited then it is assumed to be 0, if end - length is used as end value.
  • [index] : Object
    Refers to a particular element of the array at the index position. Index is zero-based.
  • length : Integer
    GetNext number of items in array

Methods

  • clone() : Array
    Returns brand new copy of the array.
  • concat([value1 [, value2 [, ... valueN]]]) : Array
    Appends array by values.
  • filter(callback[, thisObject]) : Array
    This method calls the callback function once for each element in the array, and constructs new array of all the values for which the callback returns true. The filter method does not mutate the array on which it is called.
  • indexOf(value [,notfound = -1]) : Object
    Find value in the array.
  • join(delimiter) : String
    Creates string fram all array's elements separated by the delimeter. If delimiter is not specified, the default is comma.
  • lastIndexOf(value [,notfound = -1]) : Object
    Get last index of the value in array. If the value is not found returns the notfound value (-1 by default).
  • map(callback[, thisObject]) : Array
    This method creates a new array with the result of calling a provided callback function on every element in this array. If thisObject is provided then the callback will have it as this. The map method does not mutate the array on which it is called.
  • pop() : Object
    Removes last element from array. This affects the length of the array!
  • push([value1 [, value2 [, ... valueN]]]) : Object
  • reduce(callback[, initialValue]) : Array
    This method applies the function simultaneously against two values of the array (from left-to-right) as to reduce it to a single value. The method returns result of last callback invocation. The method does not mutate the array on which it is called.
  • remove(index) : Object
    Removes element at index.
  • removeByValue(value) : Object
    Tries to locate element by value in the array and removes it.
  • reverse() : Array
    Reverses order of elements in the array in-place. Returns the array.
  • shift() : Object
    Removes first element of the array. This method changes the length of an array!
  • slice(start [, end]) : Array
    Create new array consisting from elements of the array from start up to but not including end index, order between start and end (not included) index.
  • sort([sortFunction]) : Array
    Sorts elements of the array in ascending order, if the sortFunction provided is used for comparing elements during sort.
  • this(..) : Array
    Creates new array object from arguments provided.
  • toString() : String
    Create comma separated string from array.
  • unshift(value) : Object
    Inserts a value at first array position.
  • valueOf() : String
    Same as toString - creates comma separated string from array.
API Navigation
Skip Navigation Links.
Expand <span>User Interface</span> User Interface
Collapse <span>Core & System</span> Core & System
System
Object
Integer
Float
String
Date
Math
Array
RegExp
Global
Function
Timer
Expand <span>Graphics</span> Graphics
Expand <span>Files and Databases</span> Files and Databases
Expand <span>Crypto</span> Crypto
Expand <span>Native User Interface</span> Native User Interface
Expand <span>Net</span> Net
Expand <span>Media</span> Media
Expand <span>Sensor</span> Sensor
Expand <span>Game Development</span> Game Development