Reverses the given list of elements order.
✅
Immutable: This does not mutate the given array.
Syntax
import { reverse } from '@opentf/std';
reverse<T>(arr: T[] = []): T[]
Examples
reverse([1, 2, 3]) //=> [3, 2, 1]
reverse([{ a: 1 }, { b: 2 }, { c: 3 }])
//=> [
// {
// c: 3,
// },
// {
// b: 2,
// },
// {
// a: 1,
// },
// ]
reverse('Apple')//=> ['e', 'l', 'p', 'p', 'A']
reverse([1, , 3])//=> [3, undefined, 1]