I have three arrays containing strings of CSS class names.
I need to take one string from each of these arrays, and combine it with values from the other two arrays to form all possible unique string combinations.
Here are the arrays I need to transform:
var array_one = [
".cat-616",
".cat-1146",
".cat-1144"
];
var array_two = [
".hair-light-brown",
".hair-red"
];
var array_three = [
".eyes-hazel",
".eyes-dark-brown",
".eyes-blue-green"
];
The strings I’ll need to form are:
'.cat-616.hair-light-brown.eyes-hazel',
'.cat-616.hair-light-brown.eyes-dark-brown',
'.cat-616.hair-light-brown.eyes-blue-green',
'.cat-616.hair-light-red.eyes-hazel',
'.cat-616.hair-light-brown.eyes-hazel',
'.cat-616.hair-light-brown.eyes-dark-brown',
'.cat-616.hair-light-brown.eyes-blue-green',
'.cat-1146.hair-light-brown.eyes-hazel',
'.cat-1146.hair-light-brown.eyes-dark-brown',
'.cat-1146.hair-light-brown.eyes-blue-green',
'.cat-1146.hair-red.eyes-hazel'
…etc.
How do I iterate over these arrays to form the string combinations? My thinking is that Lodash could come in useful for transforming these arrays?