![]() |
VOOZH | about |
The d3.cross() function in D3.js is used to return the cartesian product of the given two arrays A and B.
d3.cross(Array1, Array2)This function accepts two parameters which are mentioned above and described below:
It returns the cartesian product array of two-element each of two given array.
Example 1: This example shows the use of cross() function.
Output:
[[10, 1], [10, 2], [10, 3], [20, 1], [20, 2], [20, 3], [30, 1], [30, 2], [30, 3]]Example 2: This example shows the use of cross() function.
Output:
[[A, a], [A, b], [A, c], [B, a], [B, b], [B, c], [C, a], [C, b], [C, c]]