Is there a way to transform array a into array b?
Alternatively, how can I create a matrix-style multidimensional array using the values from array a below?
SPECIFICATIONS: 1. The length of array a is variable. 2. Each element in array a has a variable length as well.
const a = [
['red', 'blue'],
['small', 'medium', 'large'],
]
const b = [
['red', 'small'],
['red', 'medium'],
['red', 'large'],
['blue', 'small'],
['blue', 'medium'],
['blue', 'large'],
]
Example 2:
const a = [
['quadcore'],
['4GB', '8GB'],
['black', 'grey'],
]
const b = [
['quadcore', '4GB', 'black'],
['quadcore', '4GB', 'grey'],
['quadcore', '8GB', 'black'],
['quadcore', '8GB', 'grey'],
]