Skip to content

Instantly share code, notes, and snippets.

@JimOfLeisure
Created January 27, 2022 05:53
Show Gist options
  • Save JimOfLeisure/175723b0fec3ba183db9734be16a7ff9 to your computer and use it in GitHub Desktop.
Save JimOfLeisure/175723b0fec3ba183db9734be16a7ff9 to your computer and use it in GitHub Desktop.
An example during a stream
function spoonerize(words) {
output = new Array();
let wordList = words.split(' ');
for (let i=0; i<wordList.length; i++) {
let myWord = wordList[i].replace(/^./, wordList[wordList.length - i - 1][0]);
output.push(myWord)
}
return output.join(' ');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment