Function arrSortNumeric

  • Sorts an array of numbers, bigints, or booleans in ascending order.

    Parameters

    • input: (number | bigint | boolean)[]

      The array to be sorted.

    Returns (number | bigint | boolean)[]

    The sorted array.

    Remarks

    This function uses the JavaScript Array.prototype.sort() method, which sorts elements in place. Therefore, the original array will be modified.

    Throws

    If any element in the input array is not a number, bigint, or boolean.

    Example

    const input = [5, 2n, true, 10, false];
    arrSortNumeric(input);
    //=> [false, true, 2n, 5, 10]

Generated using TypeDoc