Make a copy of an nD array. If the input is not an array, then just return the same thing. A new array is returned. The input array remains unchanged. If the input array is undefined, an empty array is returned. If the input is s sparse array, then the output will alos be a sparse array.
The nD array to copy.
The new nD array.
Counts the number of values in an nD array . The input array remains unchanged. If the input array is undefined, 0 is returned. The input can be a sparse array. Undefined values are ignored. For example, for [1, 2, , , 3], the count will be 3.
The nD array to count.
The number of elements in the nD array.
Fills an nD array with new values (all the same value). The input array is changed. If the input array is undefined, an empty array is returned. The input can be a sparse array.
The nD array to fill.
The value to insert into the array.
Check if two nD arrays are equal (i.e. that all elements in the array are equal, ===.). If the arrays are unequal in length, false is returned. Elements in the array can have any value.
The first value.
The second values.
True or false.
Take an nD array and flattens it. A new array is returned. The input array remains unchanged. For example, [1, 2, [3, 4], [5, 6]] will become [1, 2, 3, 4, 5, 6]. If the input array is undefined, an empty array is returned.
The multidimensional array to flatten.
A new 1D array.
Find the position of the first occurrence of a specified value in an array. The value can be an array (which is not the case for Array.indexOf()). If the value is not found or is undefined, return -1. If the array is null or undefined, return -1.
The value, can be a value or a 1D array of values.
The index in the array of the first occurance of the value.
Make an array of numbers. All elements in the array will have the same value.
The length of the new array. If length is 0, then an empty array is returned.
The values in the array.
The resulting array.
Make an array of numbers. All elements in the array will be a numerical sequence, 0, 1, 2, 3....
The length of the new array. If length is 0, then an empty array is returned.
The resulting array.
Replace all occurrences of a specified value in an array. The input array is changed. The value can be an array. If the value is not found or is undefined, return -1.
The array.
The old value to replace.
The new value.
Generated using TypeDoc
A set of static methods for working with arrays of simple types. The arrays can be nested, but they do not contain any objects.