119
rated 0 times
[
121]
[
2]
/ answers: 1 / hits: 80105
/ 12 Years ago, thu, september 6, 2012, 12:00:00
How would you implement the Cartesian product of multiple arrays in JavaScript?
As an example,
cartesian([1, 2], [10, 20], [100, 200, 300])
should return
[
[1, 10, 100],
[1, 10, 200],
[1, 10, 300],
[2, 10, 100],
[2, 10, 200]
...
]
More From » arrays