Cartesian product of multiple arrays in JavaScript

0 votes

How can I find the cartesian product of multiple arrays using JavaScript?

Take this for example

cartesian([1, 2], [10, 20], [100, 200, 300]) 

this should return something like this

[
  [1, 10, 100],
  [1, 10, 200],
  [1, 10, 300],
  [2, 10, 100],
  [2, 10, 200]
  ...
]
Jul 28, 2022 in TypeSript by krishna
• 2,820 points

edited Mar 4 8 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP