Created
January 27, 2022 05:53
-
-
Save JimOfLeisure/175723b0fec3ba183db9734be16a7ff9 to your computer and use it in GitHub Desktop.
An example during a stream
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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