UNPKG

@stdlib/array

Version:
33 lines (23 loc) 694 B
{{alias}}( x, indices ) Takes elements from an indexed array. If `indices` is an empty array, the function returns an empty array. The function does *not* perform bounds checking. If an index is less than zero or greater than the maximum index of `x`, the value of the corresponding element in the output array is undefined. Parameters ---------- x: ArrayLikeObject Input array. indices: ArrayLikeObject<integer> List of element indices. Returns ------- out: Array Output array. Examples -------- > var x = [ 1, 2, 3, 4 ]; > var y = {{alias}}( x, [ 1, 3 ] ) [ 2, 4 ] See Also --------