Create the Cartesian product using Typescript

Peter Prins
May 31, 2020

--

Today I had to create an array of all possible combinations of multiple arrays. In other words, I had to calculate the Cartesian product. Below you’ll find my implementation and test cases.

Implementation:

Tests:

If you have any questions, let me know in the comments! If this post has helped you, let me know by giving it a thumbs up.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Peter Prins
Peter Prins

Written by Peter Prins

Nerd Entrepreneur who loves to improve peoples’ lives with software. Passionate about software architecture and usability. Shares knowledge to help others.

Responses (1)