I have an array structured as follows:
const input_array= [
["red", "green"],
["small", "medium"],
["x", "y", "z"]
//... can have any number of rows added dynamically
];
How can I transform this array into the following format?
const finallist = [
["red", "small", "x"],
["red", "small", "y"],
["red", "small", "z"],
["red", "medium", "x"],
["red", "medium", "y"],
["red", "medium", "z"],
["green", "small", "x"],
["green", "small", "y"],
["green", "small", "z"],
["green", "medium", "x"],
["green", "medium", "y"],
["green", "medium", "z"],
]
Keep in mind that the input_array can vary in size.
I'm looking for advice on how to achieve this transformation. Thanks!