Let's just say I have an array with n number of index:
0:{prop1: 'abc', prop2: ['1', '2', '3'],
1:{prop1: 'xyz', prop2: ['8', '6']
Now, what I am trying to make is a combination like this:
(1,8)
(1,6)
(2,8)
(2,6)
(3.8)
(3,6)
I have tried multiple methods couldn't achieve this combination
Check CartesianProduct class from package js-combinatorics, I think this is the right tool for your task:
let it = new CartesianProduct('123','86');
it.length; // 6
[...it]; /* [
['1', '8'],
['2', '8'],
['3', '8'],
['1', '6'],
['2', '6'],
['3', '6']
] */