0

I am looking for a solution a problem with combining elements in an arrays, specifically in javascript. I would be very glad for any advice before my brain explodes.

I have 3 arrays for an example:

let arr1 = [1, 2, 3, 4]

let arr2 = ['a', 'b', 'c', 'd']

let arr3 = [true, false]

The goal is to generate one array of arrays where all combinations of elements in the array exists but with the order mattering.

Like this:

let finalArray = [[1, 'a', true], [2, 'a', true], [1, 'b', true], [2, 'c', false]...[4, 'd', false]]

I would be grateful for advice :), Thank you

I've tried concat function but it creates one flat array.

adferg
  • 1

0 Answers0