• Remove and return a value at a specific index in an array.

    Type Parameters

    • T

    Parameters

    • array: T[]

      The array of interest.

    • index: number

      The index of the value to remove. Negative values are taken as an offset from the end of the array.

    Returns T | undefined

    The value at the specified index, or undefined if the index is out of range.

    Complexity

    Linear.

    Undefined Behavior

    An index which is non-integral.

    Example

    import { ArrayExt } from '@lumino/algorithm';

    let data = [0, 12, 23, 39, 14, 12, 75];
    ArrayExt.removeAt(data, 2); // 23
    ArrayExt.removeAt(data, -2); // 12
    ArrayExt.removeAt(data, 10); // undefined;