I have an array [a, b, c]. I want to be able to insert a value between each elements of this array like that: [0, a, 0, b, 0, c, 0].
[a, b, c]
[0, a, 0, b, 0, c, 0]
I gues
Another ES6+ version using flatmap (if creation of a new array instead is ok):
['a', 'b', 'c', 'd'] .flatMap((e, index) => index ? [e, 0] : [0, e, 0])