Can a function be created to generate an array like the following?
["0-AA", "0-BB", "1-AA", "1-BB", "2-AA", "2-BB", "3-AA", "3-BB"]
This particular function combines two arrays with a separator '-' as shown below:
arr1 = [0,1,2,3] //numbers
arr2 = ["AA", "BB"] //codes
The resulting array length is always the product of the lengths of the two input arrays. Both arrays can vary in size and the first array always contains integers.
I'm looking for an elegant way to combine these arrays without using loops or repetitive statements. Can this be achieved using only array functions like map, concat, etc.?