iggs-utils - v2.4.0
    Preparing search index...

    Function forEach

    • Type Parameters

      • T

      Parameters

      • execs: number

        number of executions

      • fn: (i: number) => T

        function to be executed

      Returns T[]

      Executes a function a specified number of times and collects the results in an array.

      const results = forEach(5, i => i * 2);
      console.log(results); // [0, 2, 4, 6, 8]