Function cross

  • Returns the Cartesian product of the two arrays a and b. For each element i in the specified array a and each element j in the specified array b, in order, it creates a two-element array for each pair.

    Type Parameters

    • S

    • T

    Parameters

    • a: Iterable<S>

      First input array.

    • b: Iterable<T>

      Second input array.

    Returns [S, T][]

  • Returns the Cartesian product of the two arrays a and b. For each element i in the specified array a and each element j in the specified array b, in order, invokes the specified reducer function passing the element i and element j.

    Type Parameters

    • S

    • T

    • U

    Parameters

    • a: Iterable<S>

      First input array.

    • b: Iterable<T>

      Second input array.

    • reducer: ((a, b) => U)

      A reducer function taking as input an element from "a" and "b" and returning a reduced value.

        • (a, b): U
        • Parameters

          • a: S
          • b: T

          Returns U

    Returns U[]