An array groups related pieces of data in one variable. A unique number, called an index or subscript, combined with the shared variable name distinguishes each element in the array. Arrays result in shorter and simpler code in many situations because loops can deal efficiently with any number of elements by using the index number.
JScript provides two different types of arrays, JScript array objects and typed arrays. In JScript array objects, which are sparse, a script can dynamically add and remove elements, and elements can be of any data type. In typed arrays, which are dense, the size is fixed, and elements must be the same type as the base type of the array.
In This Section
Describes the two types of JScript arrays, the differences between the types, and how to choose the appropriate array type.
Explains the concept of declaring arrays and how declaring arrays with the new operator differs from declaring array literals.
Demonstrates how to access the elements of one-dimensional arrays, multidimensional arrays, and arrays of arrays.
Arrays of Arrays
Explains the concept of arrays of arrays, why arrays of arrays are useful, and how to use them.
Explains the concept of multidimensional arrays, how they differ from arrays of arrays, and how to use them.