Simple string scrambling
const split = (text) =&gt; (text.replace(/.(.)?/g, '$1') + ("d"+text).replace(/.(.)?/g, '$1')


The regex matches every other char. Do it twice, add any arbitrary char to the start of the string the second time to offset it.