subArray

subArray(array array, number start, number end) → array array
Extracts a sub-array, starting at start position and ending at end position, from given array.

*This function was removed in LS4+ and replaced by arraySlice (whose end position is excluded).*

Returns a subarray of array starting at position start and ending at position end.

Parameters
Return
Examples
var array = [0, 1, 2, 3, 4, 5]
debug(subArray(array, 2, 4)) // [2, 3, 4]
const array = [0, 1, 2, 3, 4, 5]
// subArray is INCLUSIVE at both ends, slice excludes the end: hence the + 1.
Debug.log(array.slice(2, 4 + 1)) // [2, 3, 4]
array = [0, 1, 2, 3, 4, 5]
# subArray is INCLUSIVE at both ends, the slice excludes the end: hence the + 1.
Debug.log(array[2:4 + 1])  # [2, 3, 4]

With an associative array:

var arrayAssoc = [2: 0, 3: 1, 4: 2, 5: 3, 6: 4, 7: 5]
debug(subArray(arrayAssoc, 2, 4)) // [2, 3, 4] and not [0, 1, 2]
const arrayAssoc = new Map([ [2, 0], [3, 1], [4, 2], [5, 3], [6, 4], [7, 5] ])
Debug.log([...arrayAssoc.values()].slice(2, 4 + 1)) // [2, 3, 4] and not [0, 1, 2]
array_assoc = {2: 0, 3: 1, 4: 2, 5: 3, 6: 4, 7: 5}
Debug.log(list(array_assoc.values())[2:4 + 1])  # [2, 3, 4] and not [0, 1, 2]