Tweakr
    Preparing search index...

    Function times

    • Invokes a function n times, passing the current index on each call.

      Parameters

      • n: number

        Number of times to invoke the function.

      • fn: (index: number) => void

        Function to execute, receives the current index as argument.

      Returns void

      times(3, (i) => console.log(i));
      // Output:
      // 0
      // 1
      // 2

      1.1.0