Seen some solutions using a regular for loop, but was interested in the recursive way
maybe we can define the arr as the alphabet
let arr = ['abcdefghij(...rest_of_alphabet)`]
found this on the interwebs, would this work?
Call map() using the array [ ‘a’, ‘b’, ‘c’ ] Create a new array that holds the result of calling fn(‘a’) Return [ ‘A’ ].concat( map([ ‘b’, ‘c’ ]) ) Repeat steps 1 through 3 with [ ‘b’, ‘c’ ] Repeat steps 1 through 3 for [ ‘c’ ] Eventually, we call map() with an empty array, which ends the recursion.