@trashpanda001/helpers
    Preparing search index...

    Function times

    • Return an array with the results of invoking mapFn for each index.

      Type Parameters

      • T

      Parameters

      • n: number

        a non-negative integer

      • mapFn: (i: number) => T = ...

        a function that returns the value for each index

      Returns T[]

      an array of length n

      Three times.

      import { times } from "@trashpanda001/helpers/array"

      times(3)
      // [0, 1, 2]
      times(3, (i) => i * i)
      // [0, 1, 4]