Array<T> Summary System.Array<T> is the wrapper class for arrays. Description System.Array<T> is the wrapper class for arrays. JS++ is a superset of the ECMAScript 3 JavaScript specification. The following methods were not standardized in JavaScript until ECMAScript 5: System.Array<T>.indexOf System.Array<T>.lastIndexOf System.Array<T>.every System.Array<T>.some System.Array<T>.filter System.Array<T>.map System.Array<T>.forEach System.Array<T>.reduce System.Array<T>.reduceRight For web browsers that are not ECMAScript 5-compatible, the above methods will be polyfilled automatically by the JS++ compiler if and only if the method of interest gets used. Differences to JavaScript sort() performs a numeric sort if the underlying Array type is byte, signed byte, short, unsigned short, int, unsigned int, long, unsigned long, char, float, or double. JavaScript's array sort() method will perform a string comparison so [ 1, 2, 10 ] ends up being sorted as [ 1, 10, 2 ]. Examples Instantiation 123import System; System.Array<int> arr = new System.Array<int>([1, 2, 3]); Auto-boxing 123import System; System.Array<int> arr = [1, 2, 3]; Without the wrapper class 1int[] str = [1, 2, 3]; Methods Array (Constructor)Constructs a System.Array<T> object. clearClears the array by removing all elements from the array. concatConcatenates the specified element to the end of the array. containsChecks if an element is in the array. countCounts the occurrences of a value inside the array. everyTests if the specified condition is valid for every array element. fillFills the array with the specified value. filterReturns a new array with all elements of the original array that pass the specified condition. firstReturns the first element of the array. forEachExecutes the specified function on each array element. indexOfReturns the first index of the search element in the array. isEmptyChecks if the array is empty and contains zero elements. joinReturns a string representation of the array with each element separated by commas. lastReturns the last element of the array. lastIndexOfReturns the last index of the search element in the array. lengthReturns the size of the array. mapReturns a new array with the specified operation applied to all elements of the original array. popRemoves the last element of the array. pushAdds an element to the end of the array. reduceApplies an accumulator function (on each array element from left to right) to reduce the array to a single value. reduceRightApplies an accumulator function (on each array element from right to left) to reduce the array to a single value. removeRemoves the array element at the specified index. repeatRepeats the array elements for the specified number of times. reverseReverses the elements of the array. shiftRemoves the first element of the array. sliceReturns a subset of the array beginning at the specified index until the end of the array. someTests if the specified condition is valid for at least one array element. sortSorts the elements of the array. spliceRemoves elements from the specified starting array index to the end of the array. toExternalConstructs a new external array with each element of the internal Array<T> converted to external (via an element-by-element toExternal call). If an element does not implement the System.IExportable interface, a System.Exceptions.ConversionException will be thrown. toStringReturns a string representation of the array value. unshiftAdds the specified element to the beginning of the array. valueOfReturns the primitive array value wrapped by the System.Array<T> object. Share HTML | BBCode | Direct Link