Skip to content

The Pig Latin function in the example doesn't work very well #13

@pmcelhaney

Description

@pmcelhaney

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions