Skip to content

Instantly share code, notes, and snippets.

@aglemann
Created January 7, 2012 11:56
Show Gist options
  • Save aglemann/1574561 to your computer and use it in GitHub Desktop.
Save aglemann/1574561 to your computer and use it in GitHub Desktop.
function rossify(sentence){
var re = /\w+/g, words = sentence.match(re);
return sentence.replace(re, function(){
return words.pop();
});
}
// > rossify('hi, my name is aeron. today i am good!');
// "good, am i today aeron. is name my hi!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment