Home > @wixc3/common > getCartesianProduct
Signature:
export declare function getCartesianProduct<T>(arrays: T[][]): T[][];
Parameter | Type | Description |
---|---|---|
arrays | T\[\]\[\] |
Returns:
T[][]
an array containing all the combinations of one element from each array
getCartesianProduct([
[1, 2],
[3, 4],
]); // => [[1, 3], [1, 4], [2, 3], [2, 4]]