I am trying to understand how to take an array like [1,2,3,4,5]
and then between each index, add a ,
so the array becomes [1, ', ', 2, ', ', 3, ', ', 4, ', ', 5]
I know it sounds stupid but I'm having some issues with it.
Basically, I want to use something like splice()
method, so that I can iterate over the array and each odd index, I can do splice(index, 0, ', ')
.