Function swapDelete

  • Delete an element from an array by swapping it with the last element and then truncating.

    Type Parameters

    • T

    Parameters

    • a: T[]

      Array to delete in

    • element: T

      Element to delete

    Returns undefined | T

    Swapped element, if found