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

    Function forEachConsPairs

    • executes the provided function fn once for each pair of consecutive elements of the provided array.

      Type Parameters

      • T

      Parameters

      • array: T[]
      • fn: (item1: T, item2: T) => void

      Returns void

      const array=[1,2,3,4];

      forEachConsPairs(array,console.log);

      // prints
      // 1 2
      // 2 3
      // 3 4