It gets the point across but sometimes puts letters in the wrong place. Who wants to take a stab at improving this guy?
var pigLatin = function(str) {
return str.replace(/(\w*)([aeiou]\w*)/g, "$2$1ay");
}
Hint: it would probably be easier to ditch the regular expression and just loop over the letters until you find a vowel.