Last active
December 22, 2017 21:25
-
-
Save lightdiscord/006ab0e1e290990ec8923d8a43e02a8a to your computer and use it in GitHub Desktop.
Normally, you should be able to read these sentences...
This file contains 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
const match = sentence => sentence.match(); | |
const word_manipulation = word => { | |
const characters = [...word] | |
const start = characters.shift() || '' | |
const end = characters.pop() || '' | |
return `${start}${characters.map((a) => [Math.random(),a]).sort((a,b) => a[0]-b[0]).map((a) => a[1]).join('')}${end}` | |
} | |
const test = sentence => console.log(sentence.replace(/(\w)+/g, word_manipulation)) | |
test("A day without sunshine is like, you know, night") | |
test("Hapiness is not something ready made. It comes from your own actions.") | |
test("Be yourself; everyone else is already taken.") | |
test("Don't watch the clock; do what it does. Keep going.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment