Skip to content

Instantly share code, notes, and snippets.

@markcmarino
Created February 26, 2020 18:57
Show Gist options
  • Save markcmarino/85bd382a968663adb989eab810d147e9 to your computer and use it in GitHub Desktop.
Save markcmarino/85bd382a968663adb989eab810d147e9 to your computer and use it in GitHub Desktop.
A sample anagram program...
function anagram(text) {
var a = text.split("");
for (var i = 0; i < a.length; i += 1) {
var letter = a[i];
var j = Math.floor(Math.random() * a.length);
a[i] = a[j];
a[j] = letter;
}
return a.join("");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment