• Generates an Array with a given length, and calls a Function for each index to determine it's value.

    Example

    const result = generate(3, (index) => -index);

    console.log(result); // [-1, -2, -3]

    Returns

    the generated Array

    Type Parameters

    • T

      the Array value type

    Parameters

    • length: number

      the Array length

    • mapper: Mapper<number, T>

      the Function to call for each index

    Returns T[]

Generated using TypeDoc