I have a series of lists, call them A, B, C, D, E. Now every list has 5 elements with identical names, say:
A: [ 'Cars_A', 'Planes_A', 'Houses_A', 'Bikes_A' ]
B: [ 'Cars_B', 'Planes_B', 'Houses_B', 'Bikes_B' ]
etc..
What I want is a list of lists, of the form:
[ ['Cars_A', 'Planes_B'], ['Cars_A', 'Houses_B'], ['Cars_A', 'Bikes_B'],
['Planes_A', 'Cars_B'], ['Planes_A', 'Houses_B'], ['Planes_A', 'Bikes_B'],
['Houses_A', 'Cars_B'], ['Houses_A', 'Planes_B'], ['Houses_A', 'Bikes_B'],
['Bikes_A', 'Cars_B'], ['Bikes_A', 'Planes_B'], ['Bikes_A', 'Houses_B'] ]
As can be seen, the rule for this list is:
An element cannot be grouped with another element from the same set, for example ['Cars_A', 'Planes_A'] is not allowed.
An element cannot be grouped with a similar element from a different set, for example ['Cars_A', 'Cars_B'] is not allowed.
My attempt right now is to do nested for loops for all 5 lists, but I want to avoid this if possible. Any ideas?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)