Options
All
  • Public
  • Public/Protected
  • All
Menu

Module array/reverse

Index

References

Functions

References

Renames and re-exports reverse

Functions

  • reverse(list: string): string
  • reverse<T>(list: ArrayLike<T>): T[]
  • Returns a new list or string with the elements or characters in reverse order.

    example
     reverse([1, 2, 3]);  //=> [3, 2, 1]
    reverse([1, 2]); //=> [2, 1]
    reverse([1]); //=> [1]
    reverse([]); //=> []

    reverse('abc'); //=> 'cba'
    reverse('ab'); //=> 'ba'
    reverse('a'); //=> 'a'
    reverse(''); //=> ''

    Parameters

    • list: string

    Returns string

  • Returns a new list or string with the elements or characters in reverse order.

    example
     reverse([1, 2, 3]);  //=> [3, 2, 1]
    reverse([1, 2]); //=> [2, 1]
    reverse([1]); //=> [1]
    reverse([]); //=> []

    reverse('abc'); //=> 'cba'
    reverse('ab'); //=> 'ba'
    reverse('a'); //=> 'a'
    reverse(''); //=> ''

    Type parameters

    • T

    Parameters

    • list: ArrayLike<T>

    Returns T[]

Generated using TypeDoc