-
-
Save tunnckoCore/398939f40c345ee211a6 to your computer and use it in GitHub Desktop.
Typoglycemia.js http://en.wikipedia.org/wiki/Typoglycemia
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
function scramble(input) { | |
return input.replace(/\b(\w)(\w{2,})(\w)\b/g, function(all, a, b, c) { | |
return a | |
+ b.split('').sort(function(){return Math.random()-.2}).join('') | |
+ c; | |
}); | |
} | |
input = prompt("Enter the message you want scrambled:"); | |
console.log(scramble(input)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment