Array object

The Array objects allow you to perform advanced array manipulations. The Array object can be created using the one of the following syntaxes:

var EmptyArray = new Array();
var TestArray = new Array(10); // create an empty array with 10 items
var DaysArray = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");


Конструкторы

Array Creates an empty array object.
Array Creates an array object with the specified number of items.
Array Creates an array object and fills it with the specified items.

Методы

Push Adds one or more items to the end of the array.
Pop Removes a last item from the array and returns it.

Атрибуты

Type (только для чтения) Returns always "array"
Length Gets or sets the current length of the array, deleting the extra items if necessary.
[index] You can set/get individual items of an array using the usual square bracket notation.

Array()

Creates an empty array object.


Array(NumItems)

Creates an array object with the specified number of items.

Параметры

NumItems
The initial number of items contained in the array

Array(Item1, Item2, Item3, ...)

Creates an array object and fills it with the specified items.

Параметры

ItemX
A value you want to add to the array

Push(Item1, Item2, Items3, ...)

Adds one or more items to the end of the array.

Параметры

ItemX
A value you want to add to the array

Возвращаемое значение

Returns the new length of the array.


Pop()

Removes a last item from the array and returns it.

Возвращаемое значение

Returns the last item of the array.