I'm trying to figure out how to take an array of type [1,2,3,4,5], and then add between each index ,so that the array becomes[1, ', ', 2, ', ', 3, ', ', 4, ', ', 5]
I know this sounds silly, but I have problems with it.
Basically, I want to use something like a method splice()so that I can iterate over an array and every odd index I can do splice(index, 0, ', ').
source
share