• Returns the item at a given index. If the index does not exist, def is returned

    Example

    get([1, 2, 3], 0, 'default value'); // 1
    

    Example

    get([1, 2, 3], 4, 0); // 0
    

    Type Parameters

    • T extends unknown[]

    • I extends number

    • F = null

    Parameters

    • array: T
    • index: I
    • Optional fallback: F = ...

    Returns F | T[I]

Generated using TypeDoc