The Array
class is a class that handles arrays.
You can create objects of this class and treat them like arrays using the subscripts specified by the indirect member selection operator.
Subscripts are integers.
0
represents the first element and 1
represents the next element.
If you specify a negative integer, it is treated as specified from the end of the array (-1
represents the last element).
The size of the array does not need to be declared.
The size is automatically expanded to the size of the specified subscript, and elements with no assigned value are initialized to void.
There is also a count property, which represents the size of the array.
You can also change the size of the array by assigning a value to the count property.
You can use []
to write an object of class Array in an expression on the fly.
In []
, separate the expressions that are the initial elements, separated by commas.
For example
var ar = ["a", "b", "c"];
If you write, ar is assigned a reference to an object of the Array class that contains the elements "a"
, "b"
, and "c"
.
You can also use []
to generate an Array class.
var ar = [];
When
var ar = new Array();
Is the same.