Skip to content

Instantly share code, notes, and snippets.

@jorinvo
Last active January 4, 2016 04:08
Show Gist options
  • Save jorinvo/8566064 to your computer and use it in GitHub Desktop.
Save jorinvo/8566064 to your computer and use it in GitHub Desktop.
some string fun
function alphabetSoup(str) {
return str.split(' ').map(function(word) {
var parts = word.substr(1,word.length-2).split('')
.sort(function(){ return Math.random(); })
.join('');
return word[0] + parts + word[word.length-1];
}).join(' ');
}
function rollercaster(str) {
return str.split('').map(function(char, i) {
return i%2 ? char.toLowerCase() : char.toUpperCase();
}).join('');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment